0

I have this simple code that creates a message box. I to make a loop that loops the code that creates the message box until a certain variable value is met.

Here is the code I want to loop:

  do x=msgbox ("some text" ,2+16, "text") loop

I want to loop the code until variable i equals 10. I am new to .VBS and don't know how to implement that. Any help is appreciated!

JSman225
  • 96
  • 1
  • 16

1 Answers1

0

I guess you just want a simple while loop like

Dim x
x=1
Do While x<>10
    x=msgbox ("some text" ,2+16, "text")
Loop

For more syntax, refer here: https://www.guru99.com/vbscript-looping.html#2

sfphoton
  • 127
  • 1
  • 7
  • 1
    Or you could just link the [Offical Documentation](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/cbe735w2(v=vs.84)). – user692942 May 28 '21 at 12:53
  • There is no return value from a `MsgBox()` that will give you `10` *(should be using the constants anyway)* - See [MsgBox Function](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/sfw6660x(v=vs.84)). Because of this the loop will run infinitely. Not the best example I've seen. – user692942 May 28 '21 at 12:58