If not then

H

Helmut

I have the following statement:

With...
....
....

If Not IsError(.Cells(lr, "r")) Then Application.Run "Office_Payroll_2"

....
....
End with

After it Runs the Macro "Office_Payroll_2" it continues in the current Macro.
But I want it to "Exit the Current Macro after running "Office_Payroll_2"
and close all open workbooks without saving.
what do I need to add?
 
J

Jim Cone

Sub EmptyTheBag()
'With...
Dim WkBk As Excel.Workbook
If Not IsError(.Cells(lr, "r")) Then
Application.Run "Office_Payroll_2"
For Each WkBk In Excel.Workbooks
If Not WkBk Is ThisWorkbook Then
WkBk.Close savechanges:=False
End If
Next
ThisWorkbook.Close savechanges:=False
Exit Sub
End If
'End With
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Helmut"
wrote in message
I have the following statement:

With...
If Not IsError(.Cells(lr, "r")) Then Application.Run "Office_Payroll_2"
End with

After it Runs the Macro "Office_Payroll_2" it continues in the current Macro.
But I want it to "Exit the Current Macro after running "Office_Payroll_2"
and close all open workbooks without saving.
what do I need to add?
 

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