|
-
Apr 16th, 2004, 11:03 AM
#1
Thread Starter
Hyperactive Member
Modal UserForm becomes modeless after SaveAs
Hello,
During system testing of my Excel 97/VBA, I have discovered the following bug:
I have a modal UserForm which controls the Active Worksheet (which is underneath the UserForm). I click a Save button to copy & save the Active Worksheet into another Workbook.
Here's the bug: When control returns back to my App, the UserForm is still there but in a modeless state. I can access the Worksheet - scroll, type into cells, etc. This must not happen, the Worksheet must always be controlled through the UserForm.
How do I set control back to the UserForm and disable direct access to the Worksheet after returning from the SaveAs routine?
Thank you,
CyberJar
-
Apr 16th, 2004, 11:29 AM
#2
You could probably trap for this in the Workbook_Activate() event
and handel it some way to restore the modality of the userform or
close it and re-open it.
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 17th, 2004, 06:53 PM
#3
Lively Member
Can you post your code, I tried but am unable to duplicate this error. My control stays with the form and does not shift to the sheet. Using XL97.
btw:
You might also want to protect your sheet via a password such that if control is passed to the sheet, that the users can't do any damage.
And where your form modifies the sheet, unlock and lock the sheet for the changes only.
-----
#VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP
I miss my VIC 20.
Never should have upgraded to my commodore 64. ...
-
Apr 19th, 2004, 08:48 AM
#4
Thread Starter
Hyperactive Member
Hey There,
Thanks for your replies.
I was able to solve this by explicitly setting the Worksheet to Activate.
After Downloading, the last statement was:
MyWorksheetObject.Activate
And this did the trick! Focus returns to the controlling UserForm .
Thank You,
CJ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|