My company changed from a local server to OneDrive this week, breaking a whole bunch of my macros that rely on the actual filepath rather than a URL.
After some research, I'm planning to utilize a Function created by Guido Witt-Dörring that solves the issue. However, there are hundreds of workbooks that would need to be updated with this Function and only 3 users who need to use it. I want to place the function in those 3 Personal.xlsb files and call the function from the workbooks that need it.
This works fine if the Function is in the active workbook:
But doesn't work if I'm trying to do the same thing from the Personal workbook:
I can also use application.run to call the Function without issues:
But can't use that to assign the value to anything:
So, what am I missing here? How can I assign the value of GetLocalPath to a variable whilst running it from Personal.xlsb?
Thanks!
After some research, I'm planning to utilize a Function created by Guido Witt-Dörring that solves the issue. However, there are hundreds of workbooks that would need to be updated with this Function and only 3 users who need to use it. I want to place the function in those 3 Personal.xlsb files and call the function from the workbooks that need it.
This works fine if the Function is in the active workbook:
VBA Code:
Test = GetLocalPath(ActiveWorkbook.Path)
But doesn't work if I'm trying to do the same thing from the Personal workbook:
Code:
Test = Personal.xlsb!GetLocalPath(ActiveWorkbook.Path)
I can also use application.run to call the Function without issues:
Code:
Application.Run "Personal.xlsb!GetLocalPath", (ActiveWorkbook.Path)
But can't use that to assign the value to anything:
Code:
Test = Application.Run "Personal.xlsb!GetLocalPath", (ActiveWorkbook.Path)
So, what am I missing here? How can I assign the value of GetLocalPath to a variable whilst running it from Personal.xlsb?
Thanks!