excelguru123
New Member
- Joined
- Jun 23, 2021
- Messages
- 6
- Office Version
- 2013
- Platform
- Windows
Hi all, I am running this code that has to work through multiple remote desktops. The issue is that it works from my own desktop and all of the other remote desktops except for one where it gives a run-time error 9: subscript out of range.
Prior to that, my code is calling a drive, opening a spreadsheet through the pathway:
I know Path works fine because it opens "wbMyWorkbook" but then it gives an error on the last line bolded. I added "wbMyWorkbook.Activate" incase it wasn't the active workbook but it still doesn't work. Only 1 of my remote desktops is running into this error. Any ideas would be much appreciated. Thanks.
Prior to that, my code is calling a drive, opening a spreadsheet through the pathway:
VBA Code:
File = Cells(7, 4)
Path = Cells(7, 5)
ChDrive Left(Path, 1)
ChDir Path
Set wbMyWorkbook = Workbooks.Open(FileName:=File, UpdateLinks:=False, ReadOnly:=True)
wbMyWorkbook.Activate
[B]Set wsMyWorksheet = wbMyWorkbook.Worksheets("Sheet1")[/B]
I know Path works fine because it opens "wbMyWorkbook" but then it gives an error on the last line bolded. I added "wbMyWorkbook.Activate" incase it wasn't the active workbook but it still doesn't work. Only 1 of my remote desktops is running into this error. Any ideas would be much appreciated. Thanks.