Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Update Excel sheet from Visual Basic (VB6)

    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?

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update Excel sheet from Visual Basic (VB6)

    Got it!

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •