Hello,
I have been using the macro below to find the filepath of the active workbook and open/loop through particular files. I did it in this manner so that it did not matter where users stored the workbook.
However, my new work version of excel has changed this and now Application.Activeworkbook.Path returns as:
https://NameOfMyWorkplaceHeremy.sharepoint.com/personal/jonathan_ohara_name_of_my_workplace_here/Documents/2111wk17/Conversion
Previously, Application.Activeworkbook.Path returned in the following manner:
C:\Users\46802537\OneDrive - Name Of My Workplace Here\2111wk17\Conversion\
My question is whether is it possible to amend how Application.Activeworkbook.Path operates?
I have been using the macro below to find the filepath of the active workbook and open/loop through particular files. I did it in this manner so that it did not matter where users stored the workbook.
VBA Code:
sub open_files()
Dim oFSO As Object
Dim oFolder As Object
Dim oFile As Object
Dim sFilePath As String
sFilePath = Application.Activeworkbook.Path & "\"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sFilePath)
For Each oFile In oFolder.Files
If InStr(1, oFile.Name, "TSP") > 0 And InStr(1, oFile.Name, "Blank Template") = 0 Then
Workbooks.Open (oFile)
End If
Next oFile
End Sub
However, my new work version of excel has changed this and now Application.Activeworkbook.Path returns as:
https://NameOfMyWorkplaceHeremy.sharepoint.com/personal/jonathan_ohara_name_of_my_workplace_here/Documents/2111wk17/Conversion
Previously, Application.Activeworkbook.Path returned in the following manner:
C:\Users\46802537\OneDrive - Name Of My Workplace Here\2111wk17\Conversion\
My question is whether is it possible to amend how Application.Activeworkbook.Path operates?