![]() |
vbModeless user form crashes Excel
The user form loads on workbook_open as vbmodeless. The workbook
minimizes and basically stays in the background. You cannot access the workbook unless you close the form. But once you close the form, you can open a second workbook. Then when the form is open you can access both workbooks. The problem occurs when you exit Excel without closing the form, which causes a crashed type message. I tried adding form.hide before close, but that didn't work. Any ideas? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
vbModeless user form crashes Excel
use the workbook's before close event..
example Private Sub Workbook_BeforeClose(Cancel As Boolean) test ''' Cancel = True '' use this for testing to stop the workbook closing!! End Sub Sub test() If UserForm1.Visible Then Unload UserForm1 MsgBox "Closing form" Else MsgBox "OK" End If End Sub Patrick Molloy Microsoft Excel MVP "Plutopotamus" wrote: The user form loads on workbook_open as vbmodeless. The workbook minimizes and basically stays in the background. You cannot access the workbook unless you close the form. But once you close the form, you can open a second workbook. Then when the form is open you can access both workbooks. The problem occurs when you exit Excel without closing the form, which causes a crashed type message. I tried adding form.hide before close, but that didn't work. Any ideas? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
vbModeless user form crashes Excel
Thank you, Patrick. That worked! I had tried beforeclose but obviously wasn't coding it right. Thanks much! *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 11:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com