VBA to Open Workbook not working

chehsim

New Member
Joined
Apr 19, 2016
Messages
10
Hi,

This macro was working previously. It has suddenly stopped working with
"Run-time error '1004':
Sorry, we couldn't find D:\Users\D801878\Int'l\Billing\2017_03\Billing Template_International_2017_03_SG.xlsx. Is it possible it was moved, renamed or deleted?"

My code is something like

Windows("_Macro_Duplicate Billing Templates.xltm").Activate
Src2 = Sheets("Parameters").Range("C12").Value
Workbooks.Open Filename:=Src2


where C12 is D:\Users\D801878\Int'l\Billing\2017_03\Billing Template_International_2017_03_SG.xlsx

The file is definitely in the said path and saved as the said filename! Please help!!!

Thanks!
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Between these two lines, add:

Code:
[COLOR=#333333]Src2 = Sheets("Parameters").Range("C12").Value

If Len(Dir(Src2)) <> 0 Then
Msgbox("File " & Src2 & " found.")
Else
Msgbox("File " & Src2 & " not found.")
End If

[/COLOR]
[COLOR=#333333]Workbooks.Open Filename:=Src2[/COLOR]
Can Excel find the file?
 
Last edited:
Upvote 0
Hi @yky,

Thanks for your help! I have found the error - that left me happy and feeling silly at the same time. It's a sneaky space that i missed.

But appreciate your time and help nonetheless!

Cheers!
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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