A
agarwallp
Hi I have the following code:
Dim xlapp As Excel.Application
Dim xlwkb As Excel.Workbook
Dim xlWs As Excel.Worksheet
Dim xlRng As Variant
Dim ret, a As Long
Set xlapp = CreateObject("Excel.application")
xlapp.Visible = True
Set xlwkb = xlapp.Workbooks.Open("H:\CRT\SCA\SG IM OFSGL930 - OFS
Account Listing - Dec.xls")
Set xlWs = xlwkb.Sheets(1)
DoCmd.TransferSpreadsheet acImport, 8, "tmp", "H:\CRT\SCA\SG IM
OFSGL930 - OFS Account Listing - Dec.xls", True, "A5:b310"
Set xlWs = Nothing
xlwkb.Close
Set xlwkb = Nothing
xlapp.Application.Quit
Set xlapp = Nothing
-------------------------------------
The import happens correctly but the excel.exe process is still
visible in taskmanager. If I have the DoCmd.TransferSpreadsheet after
closing the excel file,then excel.exe closes, but the problem is, I
get the error "the table contains cells that are outside the range of
cells defined in the spreadsheet"
Please help
Dim xlapp As Excel.Application
Dim xlwkb As Excel.Workbook
Dim xlWs As Excel.Worksheet
Dim xlRng As Variant
Dim ret, a As Long
Set xlapp = CreateObject("Excel.application")
xlapp.Visible = True
Set xlwkb = xlapp.Workbooks.Open("H:\CRT\SCA\SG IM OFSGL930 - OFS
Account Listing - Dec.xls")
Set xlWs = xlwkb.Sheets(1)
DoCmd.TransferSpreadsheet acImport, 8, "tmp", "H:\CRT\SCA\SG IM
OFSGL930 - OFS Account Listing - Dec.xls", True, "A5:b310"
Set xlWs = Nothing
xlwkb.Close
Set xlwkb = Nothing
xlapp.Application.Quit
Set xlapp = Nothing
-------------------------------------
The import happens correctly but the excel.exe process is still
visible in taskmanager. If I have the DoCmd.TransferSpreadsheet after
closing the excel file,then excel.exe closes, but the problem is, I
get the error "the table contains cells that are outside the range of
cells defined in the spreadsheet"
Please help