VBA Code to open a specific excel workbook from sharepoint that has a different title.

bobbyleeds84

New Member
Joined
Jan 24, 2017
Messages
1
Hi Guys,

Newbie to the forum here looking for some help with a macro.


I have got the below vba to open an individual workbook from sharepoint:

Sub grnreport()

Dim OutputFile As Workbook

Set OutputFile = Workbooks.Open("https://sharepoint.sharepoint.com/s... Reports/014_P_172_Pilot GRN Report v2.6.xlsm")

End Sub


This works great as long as I don't update the file with a new version number but as soon as the version number is changed (i.e. from v2.6 to v2.7) it won't work...which I understand why.

So I was just wondering if it is possible to make it so that it would open the workbook from sharepoint no matter what the version number is on the end of the filename?

Thanks in advance

Robert
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Well, you need to be able to list the files on the sharepoint in order to do a filename partial match to string. Can you mount the sharepoint to a local drive letter? Then you could use FileSystemObject and it would be easy. Trying to do this with HTTP is inadvisable.
 
Upvote 0

Forum statistics

Threads
1,214,845
Messages
6,121,902
Members
449,053
Latest member
Guy Boot

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