• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Map Sharepoint Address as a Drive and move files

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 <<<
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:
Back
Top