File not found -- how to suppress

E

Eric_G

I have a cell formula which references a directory and a file name within it
to reflect data for the current month (eg. c:\2008-Dec\Dec-08.xls). As part
of the macro, I take the previous month's directory and file name and REPLACE
it with the current month's directory and file name as contained in Cell
A700.

I run this replace function for both the sub-directory name and then the
file name.

Selection.Replace What:="2008-Dec", Replacement:=.Range("C" &
..Range("A700")), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

Selection.Replace What:="Dec-08", Replacement:=.Range("B" &
..Range("A700")), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

Unfortunately, the macro continues to display the 'FILE NOT FOUND' message
because in the first instance, the sub-directory may exist, but the file
doesn't exist YET in that directory. It is added later in the macro.

Is there any way to suppress this error message so that the macro can
continue to run? I tried disabling the automatic calculation first but that
didn't work.

thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top