xl.ScreenUpdating将不会保持设置为false,任何见解将不胜感激

时间:2019-11-06 12:18:57

标签: excel vb.net

以下代码是从IBM绿屏捕获信息并将数据放置在Excel中。我还有许多其他与此类似的程序,但是由于某种原因,一旦您到达带星号的代码行,它就会自动将属性切换回true。任何想法为什么会这样?我还包括了Excel的声明。

    Dim xl = GetObject(, "Excel.Application")
    Dim rates = xl.Range("A1")

    While rates.Value <> ""

        xl.ScreenUpdating = False
        btnScreenUpdating.Text = "Screen Updating Is: OFF

        Dim currentBrand = rates.Value
        rates = rates.Offset(0, 1)
        currentHotel = rates.Value
        rates = rates.Offset(0, 1)

        myscreen.SendKeys("VTDH/" & txtVendorCode.Text & "/" & currentHotel)
        myscreen.SendControlKey(ControlKeyCode.Transmit)
        myscreen.WaitForCursor(3000, 4, 2)

        ***rates.Value = myscreen.GetText(3, 2, 10)
        rates = rates.Offset(0, 1)
        rates.Value = Trim(myscreen.GetText(3, 35, 4))
        rates = rates.Offset(1, -3)

    End While

0 个答案:

没有答案