|
-
Sep 19th, 2005, 06:26 AM
#1
Thread Starter
Addicted Member
Excel - Modal forms
Hi,
Is it possible to load a form in excel as Modal, but have the assigned macro continue to run in the background?
I have a command button on a worksheet that starts a macro and opens a userform. I want the userform to show the progress of the macro in a textbox, and when done enable a button on the form. But i dont want the user to be able to move around the workbook whilst its running.
cheers
Lee Saunders
Win XP Professional : VB6 Enterprise / VB 2005 Express
History admires the wise, but it elevates the brave.
-
Sep 19th, 2005, 08:34 AM
#2
Re: Excel - Modal forms
Should be possible... in theory at least.
Code:
Userform.show vbmodal
I think. Try that and see whether the code stops until the form is closed.
Alternatively there are two properties of excel, um updatewindow and supresserrors (or view errors or something) which stop the reporting and updating (scrolling in the background...)
If you disable the update, but force a refresh on the form it might update...
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Sep 19th, 2005, 08:36 AM
#3
Re: Excel - Modal forms
Have you considered using the StatusBar to show the progress and only show the form when the macro has completed?
VB Code:
Sub SampleStatusUpdate()
Dim MyStep As Integer
Dim AllSteps As Integer
Dim OldStatusBar As Boolean
OldStatusBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
AllSteps = 10
For MyStep = 1 To AllSteps
Application.StatusBar = "On step " & CStr(MyStep) & " of " & CStr(AllSteps) & "..."
MsgBox "Hi"
Next MyStep
Application.StatusBar = False
Application.DisplayStatusBar = OldStatusBar
End Sub
Last edited by DKenny; Sep 19th, 2005 at 10:45 AM.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Sep 19th, 2005, 10:47 AM
#4
Re: Excel - Modal forms
Or you can look at it from the other end. Have the button show the form modal but inside the form have the macro code. This will keep the user from doing anything else and yet let the macro code run in the context of the form.
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 
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
|