Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Keping a UserForm open as VBA runs

Hi,

I'm designing a macro that takes a few seconds to run on
big sheets. I'd like to update the user on progress. I
could do this via the statusbar, but I'd prefer to have a
pop userform confirming the tasks as they complete.

the userform's I've developed before have to be hidden
before the code will run - how do I keep it open while the
code runs in the background..??

thks..Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Keping a UserForm open as VBA runs

What you want to do is use a Modeless form (Excel 2000 +)
I've created a userform (UserForm1) and inserted a label (Label1)

Then in Module1:

Sub testit()
Dim frm As UserForm1, dtmStart As Date

Set frm = New UserForm1
frm.Show vbModeless

frm.Label1 = "Doing wait for 3 seconds"
frm.Repaint
dtmStart = Now()
Do Until dtmStart + TimeValue("00:00:03") <= Now(): Loop

frm.Label1 = "Doing wait for 5 seconds"
frm.Repaint
dtmStart = Now()
Do Until dtmStart + TimeValue("00:00:05") <= Now(): Loop

frm.Label1 = "Finished"
End Sub


"Chris Gorham" wrote in message
...
Hi,

I'm designing a macro that takes a few seconds to run on
big sheets. I'd like to update the user on progress. I
could do this via the statusbar, but I'd prefer to have a
pop userform confirming the tasks as they complete.

the userform's I've developed before have to be hidden
before the code will run - how do I keep it open while the
code runs in the background..??

thks..Chris



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Keping a UserForm open as VBA runs

Chris,

The general technique is to show the form, then initiate your code from
within there, updating the progress bar as you go.

John Walkenbach shows how at

http://j-walk.com/ss/excel/tips/tip34.htm

He also has a more complex status bar progress bar.

http://j-walk.com/ss/excel/files/developer.htm



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Chris Gorham" wrote in message
...
Hi,

I'm designing a macro that takes a few seconds to run on
big sheets. I'd like to update the user on progress. I
could do this via the statusbar, but I'd prefer to have a
pop userform confirming the tasks as they complete.

the userform's I've developed before have to be hidden
before the code will run - how do I keep it open while the
code runs in the background..??

thks..Chris



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Keping a UserForm open as VBA runs

Chris,

You can put the code from your macro into a userform.

Private Sub UserForm_Activate()

TextBox1.Text = "Hello"

'do something

End Sub




Mike Tomasura
"Chris Gorham" wrote in message
...
Hi,

I'm designing a macro that takes a few seconds to run on
big sheets. I'd like to update the user on progress. I
could do this via the statusbar, but I'd prefer to have a
pop userform confirming the tasks as they complete.

the userform's I've developed before have to be hidden
before the code will run - how do I keep it open while the
code runs in the background..??

thks..Chris



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs Rruffpaw Setting up and Configuration of Excel 1 September 17th 11 01:25 PM
How do you make a userform open automatically when you open excel? Evan Excel Worksheet Functions 1 March 11th 10 02:24 AM
Open Workbook created in Excel 2003 in a computer that runs Excel Artur Excel Discussion (Misc queries) 0 November 22nd 06 02:01 AM
Excel runs, but files will not open [email protected] Excel Discussion (Misc queries) 1 January 11th 05 08:30 PM
macro only runs on fresh open of excel? Jake Marx[_2_] Excel Programming 0 September 19th 03 04:15 PM


All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"