VBA Sharepoint upload query

knightwriter

New Member
Joined
Jul 4, 2016
Messages
17
Hi all,

I am using the code below to upload a .xlsx file to sharepoint and it seems to only work a handful of times.

My questions is there a difference is one uses \\ or // ? And why does this only work sometimes and not all of the time?


HTML:
[CODE]Sub uploadtosharepoint()

Dim SharepointAddress As String
Dim LocalAddress As String
Dim objNet As Object
Dim FS As Object


' Where you will enter Sharepoint location path
SharepointAddress = "//teams/BusnsMan/Sales Update" & "\"
' Where you will enter the file path, ex: Excel file
LocalAddress = "F:\Sales\Planning\Sales\Sharepoint extract\Test Sales Report Input.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[/CODE]
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top