I'm getting runtime error 1004 because someone else has a shared file open. When I open the file manually, it asks if I want to open it read only. But when VBA opens the file, it says Someone else is using the file. Please try again later. Then I get the 1004 error when I return to VBA. Why can't I just open it as read only?
I also tried IgnoreReadOnlyRecommended:=True and Notify:=False.
Code:
'heirarchy
Dim hPath As String, hFile As String
Dim hwb As Workbook
Dim hws As Worksheet
hPath = "K:\Account Hierarchy\2019-20\CFC\"
hFile = hPath & "*A&S CFC Funding Hierarchy.xlsm"
Set hwb = Workbooks.Open(hFile, ReadOnly:=True)
Set hws = hwb.Worksheets(1)
I also tried IgnoreReadOnlyRecommended:=True and Notify:=False.