Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
Siva,
Thanks for the suggestion, but that isn't what I was looking for. I was hoping to find some solution similar to the Excel VBA command Application.StatusBar where I can display actual text to the user as the VBScript is progressing. The solution you propose is only the equivelant to an hour-glass effect.
Any other ideas?
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
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.