Move from shared drive to Sharepoint - killed my macro

SandsB

Well-known Member
Joined
Feb 13, 2007
Messages
729
Office Version
  1. 365
Platform
  1. Windows
The IT gods moved all my files from a shared drive to sharepoint. The links within the sheets are fine but whatever magic conversion was going on didn't do anything for my macros. This leaves me stumped.

When the file was on a shared drive.....
3 cells have values that are part of a filename to open. There are several dozen links like this in the macro but they all are some version of this.
A8 = 2024
B8 = Oct
C8 = M3

The line below worked in the macro when the input file was on a shared drive to open file V:\Reports\DB\2024\UReports\M3 Oct 2024.xlsx
Workbooks.Open ("V:\Reports\DB\" & Range("A8") & "\UReports\" & Range("C8") & " " & Range("B8") & " " & Range("A8") & ".xlsx")


I need to open the file using the same 3 cells in this example. If I manually link a cell (B5) to the file, sharepoint tells me this is the link:
='https://coname-my.sharepoint.com/personal/user_coname_com/Documents/Metrics/DB/2024/UReports/[M3 Oct 2024.xlsx]10-23'!$B$5

How do I get excel to link with this http reference and use the 3 cells as input? Is it even possible to link to a sharepoint file?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
you have to go into the macros and change their file path to where the synced data is, so like %userprofile%\YourCompanyName

You could make it something like p = ThisWorkbook.path & "\Folder names\"
or just put the full paths in starting from C: drive
 
Upvote 0
Open the Workbook from the SharePoint. Open the VBA Project Explorer. Double click on ThisWorkbook. Type Debug.Print ThisWorkbook.Path in the Immediate Window. That's what you will have to replace the old drive paths with.
 
Upvote 0

Forum statistics

Threads
1,222,905
Messages
6,168,948
Members
452,227
Latest member
sam1121

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