bizybeaver
Technical User
I have a simple script to copy a file from a server (network) to a local machine.
I am in a Windows domain and I can't use a mapped drive letter as this would be used by several people. I figured I could copy a file directly by using \\server\folder\etc but my code just stops and says Path not found. If I copy and paste it into IE, for example, it works.
Do I have to have a mapped drive? Or is there a way I can supply the current user ADID and password to gain access and map a drive and then discconect it?
Dim sh
Dim strFolder
Dim objFSO
set sh = CreateObject("WScript.Shell")
strFolder = "C:\Documents and Settings\%UserName%\Application Data\Microsoft\Templates"
Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "\\kceiscp202a\bus_sale_dev\Copy Test.doc", strFolder & "\", OverwriteExisting
Set sh = Nothing
Set strFolder = Nothing
Set objFSO = Nothing
I am in a Windows domain and I can't use a mapped drive letter as this would be used by several people. I figured I could copy a file directly by using \\server\folder\etc but my code just stops and says Path not found. If I copy and paste it into IE, for example, it works.
Do I have to have a mapped drive? Or is there a way I can supply the current user ADID and password to gain access and map a drive and then discconect it?
Dim sh
Dim strFolder
Dim objFSO
set sh = CreateObject("WScript.Shell")
strFolder = "C:\Documents and Settings\%UserName%\Application Data\Microsoft\Templates"
Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "\\kceiscp202a\bus_sale_dev\Copy Test.doc", strFolder & "\", OverwriteExisting
Set sh = Nothing
Set strFolder = Nothing
Set objFSO = Nothing