R
Richard Choate
I'm going bananas! My Access code sets up a new instance of Excel and a new
ADO connection via the following code, after I dim the variables:
Set cnt = New ADODB.Connection
Set rst = New ADODB.Recordset
cnt.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDB & ";" & "Jet OLEDBatabase Password=XXXXX"
' Open recordset based on Orders table
rst.Open mySQL, cnt
Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.workbooks.Open("G:\Path\Path2\Path3\ExcelFile.xls")
Set xlWs = xlWb.Worksheets("Data")
Then, I have code to transfer data and massage it a little bit, and then I
close my references with this:
rst.Close
cnt.Close
Set rst = Nothing
Set cnt = Nothing
' Release Excel references
Set xlWs = Nothing
Set xlWb = Nothing
Set xlApp = Nothing
But then, when I try to open those excel files to see if everything looks
OK, they are locked for editing and the instances of Excel are still open. I
end up having to use the task manager to shut them down. Where did I go
wrong ???
Richard Choate
ADO connection via the following code, after I dim the variables:
Set cnt = New ADODB.Connection
Set rst = New ADODB.Recordset
cnt.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDB & ";" & "Jet OLEDBatabase Password=XXXXX"
' Open recordset based on Orders table
rst.Open mySQL, cnt
Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.workbooks.Open("G:\Path\Path2\Path3\ExcelFile.xls")
Set xlWs = xlWb.Worksheets("Data")
Then, I have code to transfer data and massage it a little bit, and then I
close my references with this:
rst.Close
cnt.Close
Set rst = Nothing
Set cnt = Nothing
' Release Excel references
Set xlWs = Nothing
Set xlWb = Nothing
Set xlApp = Nothing
But then, when I try to open those excel files to see if everything looks
OK, they are locked for editing and the instances of Excel are still open. I
end up having to use the task manager to shut them down. Where did I go
wrong ???
Richard Choate