I am trying to use VBA to open a SharePoint File and write data to it and then save and close the file.
The code below works when it is a traditional file path. By defining the term Destination, it allows me to differentiate between the original workbook that I am copying data from and the "Destination" workbook that I am pasting data to.
I can open the SharePoint file using the following code:
However, I cannot figure out how to set the term "Destination" to be the opened SharePoint file, so that the rest of my copying and pasting code works. The following code results in a "Compile Error: Expected End of Statement"...
I've tried making the newly opened SharePoint File the "Active" Workbook, but it doesn't work with all of the copying and pasting between files.
Any advice or guidance would be greatly appreciated.
The code below works when it is a traditional file path. By defining the term Destination, it allows me to differentiate between the original workbook that I am copying data from and the "Destination" workbook that I am pasting data to.
VBA Code:
Dim Destination As Workbook, dPath, Source As Range
dPath = [filepath]
Set Destination = Workbooks.Open(dPath)
I can open the SharePoint file using the following code:
VBA Code:
Dim Destination As Workbook, dPath, Source As Range
dPath = [sharepointfilepath]
ActiveWorkbook.FollowHyperlink Address:=(dPath)
However, I cannot figure out how to set the term "Destination" to be the opened SharePoint file, so that the rest of my copying and pasting code works. The following code results in a "Compile Error: Expected End of Statement"...
VBA Code:
Set Destination = ActiveWorkbook.FollowHyperlink Address:=(dPath)
I've tried making the newly opened SharePoint File the "Active" Workbook, but it doesn't work with all of the copying and pasting between files.
Any advice or guidance would be greatly appreciated.