Error handling
Excel 97
I am attempting to move several sheets from one workbook to another for
purposes of emailing only the selected sheets. I am using an array to
select the sheets by name. The code works fine except when a sheet does
not exist. I would like to pop up an error message with the name of the
missing sheet and the option to continue with the sheets that exist. I have
limited experience in this area, and have tried on error goto ErrHandler,
but this does not continue moving the rest of the sheets in the array.
Below I have listed the code. Any help would be greatly appreciated.Thanks
Valerie
Sub ExportSouth()
'Macro Step 3 Export South Sheets
'Opens South Workbook and moves store Sheets to the workbook used for
emailing
'Opens Email to send to District manager
Workbooks.Open FileName:="\\xxx\xxx\xxx\Payroll\South Cover Sheet.xls"
Windows("cover.xls").Activate
Sheets(Array("41 Clark.", "43 Mad.", "44 N.A.", "49 Jeff.")).Move
Befo=Workbooks( _
"South Cover Sheet.xls").Sheets(1)
ActiveWorkbook.Save
Call Email
Sheets(Array("41 Clark.", "43 Mad.", "44 N.A.", "49 Jeff.")).Delete
ActiveWorkbook.Save
ActiveWorkbook.Close
Windows("cover.xls").Activate
Sheets("check List").Range("b9") = "X"
End Sub
|