Results 1 to 4 of 4

Thread: [RESOLVED] Can I use Forms?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Location
    Virginia, USA
    Posts
    17

    Resolved [RESOLVED] Can I use Forms?

    Hi!

    I've created a Macro to take data in Excel and convert it to a Word-formatted document.

    When I run the macro, Word is launched in the background; and, you really can't do anyting to Excel until it is done. So, I want to add some sort of progress indicator - status bar or text status, it doesn't matter. (Status would be updated at every iteration or every 10 iterations.)

    Do I use FORMS for this? Is there something better/different? And, can I update the status while the Macro is reading from Excel and writing to the Word doc?

    I do have one Form, which prompts the user to input a filename:
    Gen_Help_WordDoc_Form.Show
    But, it seems like I have to click "Ok" or "Cancel" to get out and process everything else.

    Melissa

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Can I use Forms?

    Have you looked into the StatusBar property of the Excel Application object. I use this all the time when I'm running big pieces of code. It's the easiest way to give the user progress feedback.
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  3. #3
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Can I use Forms?

    Here's a sample piece of code for the StatusBar

    VB Code:
    1. Sub samplestatusupdate()
    2. Dim MyStep As Integer
    3. Dim AllSteps As Integer
    4. Dim saveStatusBar As Boolean
    5.  
    6. saveStatusBar = Application.DisplayStatusBar
    7. oldStatusBar = Application.DisplayStatusBar
    8. Application.DisplayStatusBar = True
    9.  
    10. AllSteps = 10
    11. For MyStep = 1 To AllSteps
    12.     Application.StatusBar = "on Step " & CStr(MyStep) & " of " & CStr(AllSteps)
    13.     MsgBox "Hi"
    14. Next MyStep
    15.  
    16. Application.StatusBar = False
    17. Application.DisplayStatusBar = saveStatusBar
    18.  
    19. End Sub
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Location
    Virginia, USA
    Posts
    17

    Re: Can I use Forms?

    Perfect! That will work for me.


    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width