M
Michel Peeters
Below is the beginning of a procedure which exports a query to an existing
XL file.
It worked for years and suddenly gives an error: "Application defined or
object-defined error " - Error 40036.
Sometimes I receive error: "unvalid use of property".
I use Access2002 with Microsoft Visual Basic 6.3
The pathname is correct.
Dim xlsApp As Excel.Application
Dim strRange As String
strPad = "K:\Genearl\tel_fax\PasAdres.xls"
If Dir(strPad) = "" Then
MsgBox strPad & " isn't a valid path!"
Exit Sub
Else
Set xlsApp = CreateObject("Excel.Application")
'You do not need to make the application object visible
'if you close the file and quit the application
'later in your code in order to remove these objects
'from memory.
xlsApp.Visible = False
xlsApp.Workbooks.Open strPad
xlsApp.Worksheets("Adressen").Activate 'here my code gives an
error
xlsApp.Worksheets("Adressen").Cells.Select
Selection.ClearContents
Range("A2").Select
End If
Tks for helping
Michel
XL file.
It worked for years and suddenly gives an error: "Application defined or
object-defined error " - Error 40036.
Sometimes I receive error: "unvalid use of property".
I use Access2002 with Microsoft Visual Basic 6.3
The pathname is correct.
Dim xlsApp As Excel.Application
Dim strRange As String
strPad = "K:\Genearl\tel_fax\PasAdres.xls"
If Dir(strPad) = "" Then
MsgBox strPad & " isn't a valid path!"
Exit Sub
Else
Set xlsApp = CreateObject("Excel.Application")
'You do not need to make the application object visible
'if you close the file and quit the application
'later in your code in order to remove these objects
'from memory.
xlsApp.Visible = False
xlsApp.Workbooks.Open strPad
xlsApp.Worksheets("Adressen").Activate 'here my code gives an
error
xlsApp.Worksheets("Adressen").Cells.Select
Selection.ClearContents
Range("A2").Select
End If
Tks for helping
Michel