VBA - copy an existing worksheet in Sharepoint to the same location

MisterProzilla

Active Member
Joined
Nov 12, 2015
Messages
264
Hi everyone,

I'm looking for a way to copy an existing file in Sharepoint to the same SP location.

I know you can use the ThisWorkbook.SaveAs method to do it from within the file itself, but I need to be able to make a copy of an external file. Finding the folder path etc is not a problem, I'm just not sure which copy method or syntax I need to use as I'm new to Sharepoint :)

Here's the most promising thing I've found online...

Code:
Sub uploadtest()


Dim ThisFilePath As String
ThisFilePath = Sheet1.Range("D4").Value 


FileCopy Source:=ThisFilePath & "Template WLP 17-18.xlsm", Destination:=ThisFilePath & "Copy1.xlsm"


End Sub

... where sheet1/D4 holds a LEFT(CELL()) formula returning the folderpath, but it bombs out with a Bad file name or number error.


Thanks for looking everyone
 
Last edited:

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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