0
votes

I'm trying to display messages as my vbscript program runs. It runs off a command prompt in xp, for example: cscript.exe test.vbs. I don't want to use msgBox while this is running as I just want it to post the scripts progress, but I don't want any user interaction.

I tried using Wscript.echo "Some text", but I'm getting compile errors when I step through the program using Words built-in vbeditor.

I found this code and it runs fine in another file:

Option Explicit
Dim strComputer
strComputer = "LocalHost"
WScript.Echo "Computer: " _
& strComputer
WScript.Quit

I then tried using Dim and set to setup a Wscript variable, but that didn't work either.

Any ideas as to what I'm doing wrong? I did verify Wscript is running on this machine.

Thanks, James

1

1 Answers

3
votes

Word uses VBA (Visual Basic for Applications), not VBScript. Although both languages belong to the Visual Basic family, they have differences. One of them is that the WScript object isn't available in VBA - that's why you're getting errors when debugging your script in Word.

Having said that, your code is valid and runs perfectly fine with both cscript and wscript.