• 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.

Upload Excel file to sharepoint

Hello All,

Kindly support me for the below situation.

i need to upload Excel file to Sharepoint, for this i am using below code, but it is not working, it is stoping at "FS.CopyFile LocalAddress, SharepointAddress"

**** Use code - tags ****
Code:
Dim NewfilePath As String
    Dim LastRow As Long
    Dim SharepointAddress As String
Dim LocalAddress As String
Dim objNet As Object
Dim FS As Object

SharepointAddress = "https://sharepoint.com/sites/Shared Documents/Forms/AllItems.aspx"

LocalAddress = (ThisWorkbook.Path & "\"ExcelFile.xlsx")
Set objNet = CreateObject("WScript.Network")
Set FS = CreateObject("Scripting.FileSystemObject")
If FS.FileExists(LocalAddress) Then
FS.CopyFile LocalAddress, SharepointAddress
End If
Set objNet = Nothing
Set FS = Nothing
   
End Sub
Thanks is Advance
Anantha
 
Last edited by a moderator:
Hello All,

Kindly support me for the below situation.

i need to upload Excel file to Sharepoint, for this i am using below code, but it is not working, it is stoping at "FS.CopyFile LocalAddress, SharepointAddress"

Seems that You copy somewhere same text
as well as You missed to Use
code - tags too.

Code:
***
Dim NewfilePath As String
    Dim LastRow As Long
    Dim SharepointAddress As String
Dim LocalAddress As String
Dim objNet As Object
Dim FS As Object

SharepointAddress = "https://sharepoint.com/sites/Shared Documents/Forms/AllItems.aspx"

LocalAddress = (ThisWorkbook.Path & "\"ExcelFile.xlsx")
Set objNet = CreateObject("WScript.Network")
Set FS = CreateObject("Scripting.FileSystemObject")
If FS.FileExists(LocalAddress) Then
FS.CopyFile LocalAddress, SharepointAddress
End If
Set objNet = Nothing
Set FS = Nothing
 
End Sub
***
Thanks in Advance
 
Last edited by a moderator:
Top