My code is below, and there's error 'VI_ERROR_TME' on 'imageBytes = osc.ReadIEEEBlock(BinaryType_UI1, True)' line.<br>
What should I do?<br>
<br>
Please Somebody Helps Me!!!<br>
<br>
<br>
--------------------------------------------------------------------------------------------------------------------------------------------------------<br>
Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)<br>
<br>
Public OSC_ioMgr As New VISAComLib.ResourceManager<br>
Public osc As New VISAComLib.FormattedIO488<br>
Public OSC_GPIO As String<br>
<br>
Public imageBytes() As Byte<br>
<br>
Sub CaptureScreen()<br>
<br>
 ' Connect to the oscilloscope<br>
    Set osc.IO = OSC_ioMgr.Open("GPIB0::15::INSTR")<br>
    <br>
    ' Set up the oscilloscope for screen capture<br>
    osc.WriteString "HARDCOPY:FORMAT BMP"<br>
    osc.WriteString "HARDCOPY:Port FILE"<br>
    osc.WriteString "HARDCOPY:PALETTE INKSAVER"<br>
    osc.WriteString "HARDCOPY:FILENAME ""FILE_INKSAVER"""<br>
    osc.WriteString "HARDCOPY START"<br>
    <br>
    Sleep 2000 ' Wait for 2 seconds<br>
    <br>
    imageBytes = osc.ReadIEEEBlock(BinaryType_UI1, True)<br>
                <br>
    'Save image to a temporary file<br>
    fileNumber = FreeFile<br>
    'Open "D:\temp.jpg" For Binary Lock Read Write As #fileNumber<br>
    Open "D:\temp.jpg" For Binary Lock Read Write As #fileNumber<br>
    Put #fileNumber, , imageBytes<br>
    Close #fileNumber<br>
    <br>
    'Load the image back into Excel<br>
    Dim picture As Shape<br>
                <br>
    Set picture = Sheets("Sheet1").Shapes.AddPicture("D:\temp.jpg", msoFalse, msoTrue, Sheets("Sheet1").Cells("A1").Left, Sheets("Sheet1").Cells("A1").Top, 1024 * 0.5, 768 * 0.5)<br>
<br>
End Sub<br>
<br>