S
Sharoninthesun
Hello
I'm having problems with Error 429 and believe it is due to the
references I am using. My aim is to import all worksheets in an Excel
2003 workbook into Access 2003 but I keep getting the same Error 429
message. I've borrowed the following code (thanks BerHav) but need to
sort out this issue. I think I may not have all the correct references
ticked - all references I do have ticked are:
Visual Basic for Applications
Microsoft Access 11.0 Object Library
OLE Automation
Microsoft DAO 3.6 Object Library
Microsoft Excel 11.0 Object Library
Microsoft Office 11.0 Object Library
Does anyone have any advice as to how to resolve this issue? I've tried
some other similar references but keep getting the same error message.
I'm quite new to this so idiot proof advice would be great!!!
Sharon
Option Compare Database
Function Test()
'Dim XLapp As Excel.Application
Dim XLapp As Object
Dim XLFile As String
Dim XLSheet As String
Dim XLRange As String
Dim TableName As String
Dim z As Integer
Dim SheetCount As Integer
Set XLapp = GetObject(, "Excel.Application")
XLapp.Visible = True
XLFile = "C:\structure.xls"
TableName = "Test"
XLRange = "!"
Set XLwb = XLapp.Workbooks.Open(XLFile)
SheetCount = XLapp.ActiveWorkbook.Sheets.Count
For z = 1 To SheetCount
XLSheet = XLapp.ActiveWorkbook.Sheets(z).Name
XLSheet = XLSheet & XLRange
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9,
TableName, XLFile, True, XLSheet
Next z
MsgBox "Imported Successfully "
XLapp.Quit
Set XLapp = Nothing
Set XLwb = Nothing
End Function
I'm having problems with Error 429 and believe it is due to the
references I am using. My aim is to import all worksheets in an Excel
2003 workbook into Access 2003 but I keep getting the same Error 429
message. I've borrowed the following code (thanks BerHav) but need to
sort out this issue. I think I may not have all the correct references
ticked - all references I do have ticked are:
Visual Basic for Applications
Microsoft Access 11.0 Object Library
OLE Automation
Microsoft DAO 3.6 Object Library
Microsoft Excel 11.0 Object Library
Microsoft Office 11.0 Object Library
Does anyone have any advice as to how to resolve this issue? I've tried
some other similar references but keep getting the same error message.
I'm quite new to this so idiot proof advice would be great!!!
Sharon
Option Compare Database
Function Test()
'Dim XLapp As Excel.Application
Dim XLapp As Object
Dim XLFile As String
Dim XLSheet As String
Dim XLRange As String
Dim TableName As String
Dim z As Integer
Dim SheetCount As Integer
Set XLapp = GetObject(, "Excel.Application")
XLapp.Visible = True
XLFile = "C:\structure.xls"
TableName = "Test"
XLRange = "!"
Set XLwb = XLapp.Workbooks.Open(XLFile)
SheetCount = XLapp.ActiveWorkbook.Sheets.Count
For z = 1 To SheetCount
XLSheet = XLapp.ActiveWorkbook.Sheets(z).Name
XLSheet = XLSheet & XLRange
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9,
TableName, XLFile, True, XLSheet
Next z
MsgBox "Imported Successfully "
XLapp.Quit
Set XLapp = Nothing
Set XLwb = Nothing
End Function