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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,454
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.
 

help_questions

Board Regular
Joined
Aug 22, 2005
Messages
215
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.....
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,454
Try using Application.DisplayAlerts = False
and then make sure to return that to True before the end of your code.
 

Forum statistics

Threads
1,141,756
Messages
5,708,329
Members
421,565
Latest member
Lastadiego

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
Top