![]() |
Macro that waits, then resumes after window is closed
Does anyone know how to do the following:
I have a macro that does some things including open up a workbook, then I need the macro to wait until this workbook is closed while I edit some values, then proceed with the rest of the macro. Any ideas? Thank you all in advance. |
Macro that waits, then resumes after window is closed
You will need 2 macros, one that opens the workbook and stops, and then trap
the BeforeClose event of that workbook. -- HTH RP (remove nothere from the email address if mailing direct) wrote in message ups.com... Does anyone know how to do the following: I have a macro that does some things including open up a workbook, then I need the macro to wait until this workbook is closed while I edit some values, then proceed with the rest of the macro. Any ideas? Thank you all in advance. |
Macro that waits, then resumes after window is closed
How do you 'stop' in VBA?
If you Exit Sub, then how do you get going again? If you find better than this, please let me know: Sub Main() ' (XL97/WIN98) Dim WBName$, i% Workbooks.Add WBName = ActiveWorkbook.Name MsgBox "Just opened " & Workbooks(WBName).Name Do While XLWinStat(WBName) ' this is the 'wait' loop ' the for..next is to not hog the system For i = 1 To 1000: DoEvents: Next i Loop MsgBox WBName & " is closed. Am proceeding ..." End Sub Function XLWinStat%(WBName$) On Error GoTo XLWSerr If Workbooks(WBName).Name = WBName Then XLWinStat = 1: Exit Function End If Stop ' never gets here XLWSerr: ' gets here when WBName is closed End Function Bob wrote: You will need 2 macros, one that opens the workbook and stops, and then trap the BeforeClose event of that workbook. michael wrote Does anyone know how to do the following: I have a macro that does some things including open up a workbook, then I need the macro to wait until this workbook is closed while I edit some values, then proceed with the rest of the macro. |
Macro that waits, then resumes after window is closed
ignore please
--ron |
All times are GMT +1. The time now is 04:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com