Help please with this code. Thanks

mopey12345

Board Regular
Joined
Nov 26, 2020
Messages
76
Office Version
  1. 2010
Platform
  1. Windows
Dim wb as Workbook
Set wb = Workbooks("C:\Users\Homeusers\Desktop\Payroll\Recall.xlsm")

The file is in the folder, spelling correct but returns Subscript error. Any help appreciated. Thanks Phil
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
In that case you will need to use
VBA Code:
Set wb = Workbooks.Open("C:\Users\Homeusers\Desktop\Payroll\Recall.xlsm")
 
Upvote 0
In that case you will need to use
VBA Code:
Set wb = Workbooks.Open("C:\Users\Homeusers\Desktop\Payroll\Recall.xlsm")
Thanks so much for your help. May I also ask. The "File in Use" notification doesn't work from the menu, but does if opened directly in the shared folder. Any thoughts. Thanks
 
Upvote 0
Don't think that ever shows when opening the file via VBA.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
You're welcome & thanks for the feedback.
No problem. Been a stumbling block for a few hours so a big help. I wonder if I could write my own "File in Use" message based on the code I had. Then I would know it wasn't open if it returned the subscript error?
 
Upvote 0
You can check to see if the file is read only, but as that's a different question you would need a new thread.
 
Upvote 0

Forum statistics

Threads
1,215,491
Messages
6,125,101
Members
449,205
Latest member
ralemanygarcia

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