none
Loop VBS Script RRS feed

  • Question

  • Hello,

    Can anyone tell me why this is not looping? I would like it to loop until I terminal the process, or for a very high number of times.

    Do
    myValue = "Never"
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Application.DisplayAlerts = False
    Set objWorkbook = objExcel.Workbooks.Open("C:\store\test.xlsx")

    objExcel.Application.Visible = True
    objExcel.Cells(1, 1).Value = "Test value2"

    objExcel.ActiveWorkbook.Save 
    objExcel.ActiveWorkbook.Close

    objExcel.Application.Quit
    WScript.Quit

    Loop While myValue = Never


    Wednesday, December 11, 2013 9:40 AM

Answers

  • Your script terminates just before the end of the loop because of this line:

    wscript.quit

    • Proposed as answer by Mike Laughlin Wednesday, December 11, 2013 2:10 PM
    • Marked as answer by Tarrley Wednesday, December 11, 2013 2:23 PM
    Wednesday, December 11, 2013 12:08 PM

All replies