• Update Excel sheet from Visual Basic (VB6)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Update Excel sheet from Visual Basic (VB6)

    Author
    Topic
    #397985

    I want to do an update in an excel sheet from a Visual Basic 6 program.

    Dim strTemp As String
    Dim strsql As String

    Dim connExcel As ADODB.connection
    Dim rs As ADODB.Recordset

    strTemp = “Provider=Microsoft.Jet.OLEDB.4.0;”
    strTemp = strTemp & “Data Source=” & “J:Test.xls;”
    strTemp = strTemp & “Extended Properties=””Excel 8.0;HDR=Yes;IMEX=1;”””

    strsql = “INSERT INTO [Bart$] VALUES(‘Testing’);”

    Set connExcel = New ADODB.connection
    connExcel.open strTemp
    connExcel.execute strsql

    connExcel.Close
    Set connExcel = Nothing

    I get the message that the sheet is not updatable. Why?

    Viewing 1 reply thread
    Author
    Replies
    • #757519

      Got it!

      ;IMEX=1 makes the recordset read only. After removing it the update was possible.

    • #757520

      Got it!

      ;IMEX=1 makes the recordset read only. After removing it the update was possible.

    Viewing 1 reply thread
    Reply To: Update Excel sheet from Visual Basic (VB6)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: