I am aware of the fact that this could be done more easily with copy and paste, but the point here is to use VBA to automate the process so some other people can just click a button and the file will be copied automatically. I have tried to use copy command under cmd but failed, as this does not invoke the password prompt windows so no way to access the hard drive. Is there any other way to tackle this issue? It does not matter if the user name and password cannot be embedded as part of the command. If the command can manage to pop up the window for user name and password entries that is also acceptable. Any suggestions? Thanks.
Asked
Active
Viewed 1,916 times
1 Answers
0
you can use vba to prompt for username and password, or store them in the file (whichever is applicable to your needs)
the command to map a drive that has a username and password is
NET USE G: \\server\path password /user:username
and
NET USE G: /delete
when you are finished
with a mapped drive, you can use object.Copy destination[, overwrite]
to copy the file, or SaveAs
if you want a copy of the current file

SeanC
- 15,695
- 5
- 45
- 66
-
Is it possible to do it without mounting the hard drive to the local machine first? – God_of_Thunder May 18 '12 at 13:56