VBA Express Forum  




Go Back   VBA Express Forum > VBA Code & Other Help > Word Help
     Feedback     
Register FAQ Members Arcade Knowledge Base Training Articles Consulting

Reply
 
Thread Tools Display Modes
Old 04-30-2012, 06:36 AM   #1
fredlo2010
 
fredlo2010's Avatar

 
Joined: Dec 2011
Posts: 230
Kb Entries: 0
Articles: 0
Solved: Waiting Form while macro Runing

Hello,

I am trying to create this form that will show on the screen while my macro is running to keep the user informed of whats going on. I don't want anything facy just a simple form with a picture and text. Maybe three dots at the end of the label that appear and disappear, but this is completely optional.

My main issue here is that i cannot get it to work. The form loads but it never disappears from screen. My word application freezes.

Here is my code

VBA:
Sub FormTryout() Load WaitingForm WaitingForm.Show 'MAKE BOLD THE VALID TIME Dim rngLook As Range Set rngLook = ActiveDocument.Content rngLook.Find.ClearFormatting rngLook.Find.Replacement.ClearFormatting rngLook.Find.Replacement.Font.Bold = True With rngLook.Find .Text = "Make this text Bold" End With rngLook.Find.Execute Replace:=wdReplaceAll WaitingForm.Hide End Sub
VBA tags courtesy of www.thecodenet.com

Any ideas?


Feedback is the best way for me to learn

Follow Me

Local Time: 10:03 PM
Local Date: 05-18-2013
Location:

 
Reply With Quote Top
Old 04-30-2012, 09:16 AM   #2
Frosty

 
Joined: Feb 2011
Posts: 1,354
Kb Entries: 0
Articles: 0
There is a property on the userform called "ShowModal" ... you want to False. Check the help file.

Another option is to simply use the Application.StatusBar (check the help file on this) to provide updating as your code runs. This removes the complexity of understanding non-modal userforms (and when to dismiss the userform).

Try the following code, to see if .StatusBar would do enough for you.

VBA:
Sub StatusBarTest Dim i As Integer For i = 1 To 1000 application.StatusBar = "Hello, processing " & i Next End Sub
VBA tags courtesy of www.thecodenet.com

Local Time: 02:03 AM
Local Date: 05-19-2013
Location:

 
Reply With Quote Top
Old 04-30-2012, 10:18 AM   #3
gmaxey
 
gmaxey's Avatar
Microsoft Word MVP 2003-2009

 
Joined: Sep 2005
Posts: 991
Kb Entries: 2
Articles: 0
Demo Modeless Form

VBA:
Sub UFDemo() Dim i As Long UserForm1.Show vbModeless Application.ScreenRefresh For i = 1 To 10000 UserForm1.Caption = "I'm running as fast a can!! " & 10000 - i & " steps to complete." DoEvents If i = 10000 Then Unload UserForm1 Next End Sub
VBA tags courtesy of www.thecodenet.com


Quote:
 
Originally Posted by: fredlo2010
Hello,

I am trying to create this form that will show on the screen while my macro is running to keep the user informed of whats going on. I don't want anything facy just a simple form with a picture and text. Maybe three dots at the end of the label that appear and disappear, but this is completely optional.

My main issue here is that i cannot get it to work. The form loads but it never disappears from screen. My word application freezes.

Here is my code

VBA:
Sub FormTryout() Load WaitingForm WaitingForm.Show 'MAKE BOLD THE VALID TIME Dim rngLook As Range Set rngLook = ActiveDocument.Content rngLook.Find.ClearFormatting rngLook.Find.Replacement.ClearFormatting rngLook.Find.Replacement.Font.Bold = True With rngLook.Find .Text = "Make this text Bold" End With rngLook.Find.Execute Replace:=wdReplaceAll WaitingForm.Hide End Sub
VBA tags courtesy of www.thecodenet.com

Any ideas?


Local Time: 02:03 AM
Local Date: 05-19-2013
Location:

 
Reply With Quote Top
Old 04-30-2012, 01:09 PM   #4
fredlo2010
 
fredlo2010's Avatar

 
Joined: Dec 2011
Posts: 230
Kb Entries: 0
Articles: 0
Hi guys,

I implemented the suggestion provided by Frosty and it works. Well at least the fact that the form shows up while the macro is running. The problem now is that does not show any content only a white form. I am still using the original code the only thing I changed was the form property "ShowModal" false.

The status bar doesn't work for me. I can only see the end part the beginning is just flickering text. I prefer the form

By the way Frosty, the macro thats running behind the form is one someone help me out with...I dont know who :?


This what I should see



This is what I get



Feedback is the best way for me to learn

Follow Me

Local Time: 10:03 PM
Local Date: 05-18-2013
Location:

 
Reply With Quote Top
Old 04-30-2012, 01:22 PM   #5
Frosty

 
Joined: Feb 2011
Posts: 1,354
Kb Entries: 0
Articles: 0
Try putting

WaitingForm.Repaint
or
Application.ScreenRefresh

in a couple of different places. My guess is that your Application.ScreenUpdating = False may be adversely impacting this the updating of your form.

Local Time: 02:03 AM
Local Date: 05-19-2013
Location:

 
Reply With Quote Top
Old 04-30-2012, 01:27 PM   #6
fredlo2010
 
fredlo2010's Avatar

 
Joined: Dec 2011
Posts: 230
Kb Entries: 0
Articles: 0
Forty yeah it works now.. perfect.

Thanks for the help once again


Feedback is the best way for me to learn

Follow Me

Local Time: 10:03 PM
Local Date: 05-18-2013
Location:

 
Reply With Quote Top
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 11:03 PM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © 2004 - 2012 VBA Express