VBS脚本不会进入循环

时间:2015-08-28 08:41:14

标签: html vbscript

我的脚本不会进入任何For循环,我一直在使用MsgBox来帮助检查,它似乎只是在没有输入的情况下跳过整个循环。 "<<<"表示问题的开始

'==========================================================
 Sub Read
'======================================================

'Read Row 
RR  = 6
PC  = 25

此时脚本应该进入循环,循环遍历文档和文件以读取和存储数据

MsgBox "front For"                           <<<

For Cx = 1 to Cint(vTFileC)
    MsgBox "in loop 1"
    Cxx = 1

    'Setting Target
    Target  = CStr(FullPath & "\" & vTFolder & "\"& vTFile & Cx &".html")

    For  x = Cxx to PC
        MsgBox "in loop 2"

        'Sets Book 1
        set oBook1 = oExcel.Workbooks.Open(Target)

        'Reading Table
        set Stock   = oExcel.Cells(RR,5)
        set ID      = oExcel.Cells(RR,3)

        'Displays Info
        MsgBox ( Cx &"/"& vTFileC &" RR: "& RR & " ID: " & ID & " Stock: " & Stock )

        'Closes Book 1
        oBook1.Close

        MsgBox "3"
        call Find_Write_Row

        r   = r   + 1
        Cxx = Cxx + 1
        RR  = RR  + 1
    Next

    'to cycle to next document
    Cx = Cx + 1

Next

这是脚本继续运行的地方,在此处和非代码的最后一部分之间跳转所有内容。

MsgBox "End"

'Quitting
oExcel.Quit

End Sub
'==========================================================

这导致我的脚本运行,然后立即关闭而不做任何事情。

这是我的脚本部分,它设置了一些正在使用的值

'==========================================================
' HTML INPUTS
'======================================================
    'Sets Target folder from HTML input
    set oTFolder = document.getElementById("Folder_")
    vTFolder = oTFolder.value

    'Sets Target file from HTML input 
    set oTFile = document.getElementById("File_")
    vTFile = oTFile.value

    'Sets file count from HTML input
    set oTFileC = document.getElementById("C_")
    vTFileC = oTFileC.value

    'Toggles visibility of excel
    set oVT = document.getElementById("VT")
    vVT = oVT.value
'==========================================================

1 个答案:

答案 0 :(得分:1)

如果name没有进入循环,则_alias会评估为小于1的内容。因此需要检查type

?explain=true