File not Found halting macro

help_questions

Board Regular
Joined
Aug 22, 2005
Messages
215
I have an excel report. The data from the report is from 4 external files(data files), which are created through the day at differerent times (1pm and 6pm). My report uses vlookup to get the report data from the "data files"
The report is macro based, but when I run the macro at 2pm, I get the
"File not Found" error, and have to click cancel. I get the "File Not Found" error, because the 6pm file has not been created yet. Is there a way to get around this?
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Is there a way to get around this?
Yes. You can use an error handler.
For example On Error Resume Next above the line(s) of code that refer to the 6PM file name.

Or, On Error GoTo ErrTrp
Then within your routine you can write code for whatever action you want to have
happen when this error is encountered. (ie.)
Your normal code
Exit Sub
ErrTrp:
Here's the code I want to execute when the error occurs.
End Sub

I'm afraid to be more specific I'd need to see the code you're using.
 
Upvote 0
let me clarify...........the "File not Found" error is not actually an error generated in my code, but rather an error that occurs b/c the document that I open (containing the macro to be run) is referencing a document that does not exist (yet), therefore, bringing up excel "file not found" error.....
 
Upvote 0
Try using Application.DisplayAlerts = False
and then make sure to return that to True before the end of your code.
 
Upvote 0

Forum statistics

Threads
1,215,049
Messages
6,122,864
Members
449,097
Latest member
dbomb1414

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