Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

If not then

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Helmut - 20 Mar 2008 15:44 GMT
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?
Jim Cone - 20 Mar 2008 16:59 GMT
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
Signature

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?

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.