Say I have the following script:

Set myTimer = 0
Do While myTimer < 10000
myTimer = myTimer + 1
Loop

MsgBox(myTimer)

When I try to run it, I get the following error:

Windows Script Host
Script: C:\vbscript\test.vbs
Line: 1
Char: 1
Error: Object required: '[number: 0]'
Code: 800A01A8
Source: Micrsoft VBScript runtime error

The output I'd expect to get is a single alert box that says 1000. Any
ideas as to what I'm doing wrong?

Re: do while loop yields "Error: Object required: '[number: 0]'" by Anthony

Anthony
Thu Nov 09 16:46:48 CST 2006


"yawnmoth" <terra1024@yahoo.com> wrote in message
news:1163112175.396599.99340@e3g2000cwe.googlegroups.com...
> Say I have the following script:
>
> Set myTimer = 0
> Do While myTimer < 10000
> myTimer = myTimer + 1
> Loop
>
> MsgBox(myTimer)
>
> When I try to run it, I get the following error:
>
> Windows Script Host
> Script: C:\vbscript\test.vbs
> Line: 1
> Char: 1
> Error: Object required: '[number: 0]'
> Code: 800A01A8
> Source: Micrsoft VBScript runtime error
>
> The output I'd expect to get is a single alert box that says 1000. Any
> ideas as to what I'm doing wrong?
>

Set is a key word to assign objects to variables. Use:-

myTimer = 0




Re: do while loop yields "Error: Object required: '[number: 0]'" by yawnmoth

yawnmoth
Thu Nov 09 17:09:21 CST 2006


Anthony Jones wrote:
> "yawnmoth" <terra1024@yahoo.com> wrote in message
> <snip>
> Set is a key word to assign objects to variables. Use:-
>
> myTimer = 0

That fixed it - thanks! :)