drakkarnoir
asked on
using vba to copy file to a network share with username and password
I have an access project and I am using the file dialog to allow a user to select a file. I need to copy this file to a network share that is not mounted as a drive, since I do not want anyone access to the shared folder, only the application.
So I need to be able to pass the username and password in the copy command somehow. I tried copy (xcopy) and cannot seem to pass username, password information. I could perhaps use net use to mount it, copy the file, then unmount it. If that turns out is the only solution, how do I find the first available drive letter to use for mounting.
So I need to be able to pass the username and password in the copy command somehow. I tried copy (xcopy) and cannot seem to pass username, password information. I could perhaps use net use to mount it, copy the file, then unmount it. If that turns out is the only solution, how do I find the first available drive letter to use for mounting.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that works good, my anti-virus popped up when doing Set oDrives = wshNet.EnumNetworkDrives but I can work around that, thanks.
You're welcome. Glad I could help.
I tried this but get object required error 424. And debugs to Set oDrives = wshNet.EnumNetworkDrives
Hi, andybrooke.
That would mean that the object wshNet wasn't created successfully on line #2 of the code or was destroyed prematurely. Can you run the code from a debugger to see what's happening?
That would mean that the object wshNet wasn't created successfully on line #2 of the code or was destroyed prematurely. Can you run the code from a debugger to see what's happening?
ASKER