4 Replies Latest reply: May 6, 2014 10:23 AM by Uchiha Itachi RSS

    Progress or Status Bar (VBScript)

      Anyone come up with a good way to display some useful text to the user WHILE the VBScript is processing?  I tried updating out to a text object, but the object is only updated when the script completes.

        • Re: Progress or Status Bar (VBScript)

          I was able to figure this out.  I created a text box, and named it "StatusBar."  I then created the below function and called the function whenever I wanted something displayed to the user DURING processing of the VB. 


          I found that the "WaitForIdle" command would make sure the text box would refresh such that the user would see the content in the "StatusBar" text box.  I also found that the "WaitForIdle" command is expensive in terms of processing time.  So I also added a parameter in the function "sUpdateScreen" that I could use to tell the function to update the screen or not.  Passing "CLS" to the function clears the text box.


          FUNCTION StatusBar(sStatusBar,sUpdateScreen)

            set myObject = ActiveDocument.GetSheetObject("StatusBar")

            set myObjectProp = myObject.GetProperties


            SELECT CASE sStatusBar

            CASE "CLS"

            myobject.SetText ""

            CASE ELSE

            myobject.SetText now & ":  " & sStatusBar & chr(10) & myobject.GetText

            END SELECT

            if sUpdateScreen = True then ActiveDocument.GetApplication.WaitForIdle

          END FUNCTION

          • Re: Progress or Status Bar (VBScript)

            This sounds to me an interesting question. I don't have much experience in status control, hence I feel so helpless on these kind of question, though I'd ever coped with a C# progressbar control. The solution here is so helpful and insightful to me. I'd like to see more related questions.