Jeyarajm2017
New Member
Hi,
I am able to map a sharepoint address as a drive but when i try to copy files from a folder it is not copying
Not sure what i am missing.
>>> anyway, You missed code - tags <<<
can someone help me on this please?
Thanks,
Jeyaraj M
I am able to map a sharepoint address as a drive but when i try to copy files from a folder it is not copying
Not sure what i am missing.
>>> anyway, You missed code - tags <<<
Code:
Sub mapdrive()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim objNet As Object
Dim SharepointAddress As String
Dim LocalAddress As String
On Error Resume Next
Set objNet = CreateObject("WScript.Network")
LocalAddress = "C:\Users\XXXXXX\Desktop\Sample.xlsx"
SharepointAddress = "https://XXXXXXX/"
On Error GoTo Disconnect
objNet.MapNetworkDrive "R:", SharepointAddress
If objFSO.FileExists(LocalAddress) Then
objFSO.CopyFile LocalAddress, "R:", True
Disconnect:
objNet.RemoveNetworkDrive "R:" '------------ To remove the temp drive
End If
Set objNet = Nothing
Set objFSO = Nothing
On Error Resume Next
End Sub
can someone help me on this please?
Thanks,
Jeyaraj M
Last edited by a moderator: