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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
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,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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