macro-file could not be found

P

puiuluipui

I haved a macro that copy information from a closed workbook. If the macro
doesn't find the closed workboo, i receive an error '1004': file......could
not be found.
Is there an code to avoid this error? Or, better...if there is an code that
will display, instead of '1004' error, a message: "there is no entry for this
day".
Can this be done?
Thanks!
 
L

Luke M

Perhaps something like:

Test = Dir("C:\Some File Path\Workbook.xls")
If Test = "" then
msgbox "There is no entry for this day"
exit sub
end if
 
P

puiuluipui

Perfect!
Thanks!

Luke M said:
Perhaps something like:

Test = Dir("C:\Some File Path\Workbook.xls")
If Test = "" then
msgbox "There is no entry for this day"
exit sub
end if

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*
 

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