Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Microsoft Word _ How To Keep Macro Running If No Records Available For Merge Doc

Posted by: baffled100 Nov 26 2019, 02:07 PM

Hi,

I have a Word macro that opens and merges 4 different Word documents with an Excel data file (the data is exported to Excel from Access). Occasionally, one of the merge documents won't have any data to merge and if that happens the macro stops with an error. Is there a way to have the Word macro continue on to the next Word document?

Thanks!

Posted by: GroverParkGeorge Nov 26 2019, 02:36 PM

You should be able to handle the specific error in your Error Handler routine.

Something like this, where XXXXX represents that specific error number:

CODE
If Err = XXXXX Then
    Resume Next
Else
    MsgBox "Bad News"
End If