Hi Bob
first thanks for replying - i appreciate your input
ok, sooo
i just got finished checking permissions on both the folder and the workbook inside. i granted full permissions to 'Everyone' for both the folder and the file. still no change.
also i am setting the mode to adModeReadWrite (since the ExcelADO sample didn't do that it was one of the first things i tried after reading the previous topic.
i'm going to put the code of my function down below so you can see exactly what i'm doing. you'll notice that i've got a passed in parameter that i'm not using yet, 'rs', which will be a recordset against the access database once i get the excel recordset to work.
let me show you my Jet settings for the excel engine:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engi nes\Excel]
"win32"="C:\\Program Files\\Microsoft Office\\Office10\\msaexp30.dll"
"DisabledExtensions"="!xls"
"FirstRowHasNames"=hex:01
"AppendBlankRows"=dword:00000001
"win32old"="C:\\WINDOWS\\System32\\msexcl40.dl l"
"ImportMixedTypes"="Text"
"TypeGuessRows"=dword:00000000
are yours different?
you'll also notice that i create the file fresh every time and execute an sql statement to create the table before opening the recordset against the xls file - but before posting this reply i tried with a pre-existing file and still no joy. i did get different behavior based on the string i passed into the 'table' parameter: the pre-existing file required me to use '[....$]' around the sheet name, but when i create the file and sheet fresh it accepts an undecorated value (i'm using "newsheet").
Code:
Public Sub WriteXlsFileADO(rs As ADODB.Recordset, fullpath As String, table As String)
On Error GoTo WriteXlsFileADOError
If Dir(fullpath) <> "" Then Kill fullpath
Dim sql As String
Dim conn As ADODB.Connection
Dim rsExcel As ADODB.Recordset
Set conn = New ADODB.Connection
With conn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;"
.Properties("Data Source") = fullpath
.Properties("Extended Properties") = "Excel 8.0;HDR=NO;"
.Mode = adModeReadWrite
.Open
End With
sql = "CREATE TABLE " & table & " (F1 char(255));"
Call conn.Execute(sql)
Set rsExcel = New ADODB.Recordset
rsExcel.Open "Select * from " & table, conn, adOpenKeyset, adLockOptimistic
rsExcel.AddNew
rsExcel.Fields(0) = "Test0"
rsExcel.Update
WriteXlsFileADODone:
Exit Sub
WriteXlsFileADOError:
Err.Description = "ERROR in WriteXlsFileADO" & vbCrLf & _
" fullpath = " & fullpath & vbCrLf & _
" table = " & table & vbCrLf & _
" err = " & Err.Description & vbCrLf
Err.Raise Err.Number
Resume WriteXlsFileADODone
End Sub