Hello, everyone!
I need to import an Excel table consisting of two worksheets named 'ISKosten' and 'ITKosten'. The first worksheet is imported flawlessly.
However, Access doesn't seem to recognise the second sheet. After this piece of code: - DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
-
"IT", vrtSelectedItem, False, "ITKosten!A1:I80000"
I get error '3011': the Microsoft-Jet-Database modul couldn't find the object 'ITKosten$A1:I80000'.
WHY not? Everything works with the first worksheet!
Any help would be very much appreciated!
OfficeDummy
5 2765
Hello, everyone!
I need to import an Excel table consisting of two worksheets named 'ISKosten' and 'ITKosten'. The first worksheet is imported flawlessly.
However, Access doesn't seem to recognise the second sheet. After this piece of code: - DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
-
"IT", vrtSelectedItem, False, "ITKosten!A1:I80000"
I get error '3011': the Microsoft-Jet-Database modul couldn't find the object 'ITKosten$A1:I80000'.
WHY not? Everything works with the first worksheet!
Any help would be very much appreciated!
OfficeDummy
leave the first sheet syntax as it is but put place a dollar sign in your syntax when you wish to import the second sheet you need two transferspreadsheet commands here remember one for the first sheet and any extra sheets need the dollar denotation for a sheet without the exclamation separator prior to the range - DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
-
"IT", vrtSelectedItem, False, "ITKosten$A1:I80000"
Jim :)
leave the first sheet syntax as it is but put place a dollar sign in your syntax when you wish to import the second sheet you need two transferspreadsheet commands here remember one for the first sheet and any extra sheets need the dollar denotation for a sheet without the exclamation separator prior to the range - DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
-
"IT", vrtSelectedItem, False, "ITKosten$A1:I80000"
Jim :)
Hi, Jim!
It still doesn't work. :( I get the same error. I tried changing the range to A1:I2000, but no success.
Any suggestions?
Hi, Jim!
It still doesn't work. :( I get the same error. I tried changing the range to A1:I2000, but no success.
Any suggestions?
ok this works 'flawlessly' on my machine amend the path to the xls file accordingly -
-
vrtSelectedItem = "D:\ITKosten.xls"
-
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
-
"IT", vrtSelectedItem, False, "ITKosten!A1:I10"
-
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
-
"IT", vrtSelectedItem, False, "ISKosten!A1:I10"
-
Jim :)
ok this works 'flawlessly' on my machine amend the path to the xls file accordingly -
-
vrtSelectedItem = "D:\ITKosten.xls"
-
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
-
"IT", vrtSelectedItem, False, "ITKosten!A1:I10"
-
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
-
"IT", vrtSelectedItem, False, "ISKosten!A1:I10"
-
Jim :)
But I thought vrtSelectedItem is already path direction, because I choose the Excel file from the FileDialog window. And I can't give a fixed path in the code because those tables are created weekly, and have therefore to be imported on a weekly basis...
Anyway, everything works miraculously now, even though I haven't changed a single thing neither in the code nor in the Excel map. (????)
It'd be still interesting to find out, what the problem was.
Best,
OfficeDummy
But I thought vrtSelectedItem is already path direction, because I choose the Excel file from the FileDialog window. And I can't give a fixed path in the code because those tables are created weekly, and have therefore to be imported on a weekly basis...
Anyway, everything works miraculously now, even though I haven't changed a single thing neither in the code nor in the Excel map. (????)
It'd be still interesting to find out, what the problem was.
Best,
OfficeDummy
Ask Bill Gates :)).. fact is vrtSelected item is a variable having an assigned value (and logically I agree with you) should contain the path to the relevant excel file whether this be hard coded or passed by the filedialog method, provided it identifies the file, this should be sufficient the only variances here are the actual targetted sheet within the file itself as required by the transferspreadsheet method
Regards
Jim :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Allison Bailey |
last post by:
Hi Folks,
I'm a brand new Python programmer, so please point me in the right
direction if this is not the best forum for this question....
I would like to open an existing MS Excel spreadsheet...
|
by: jillandgordon |
last post by:
I am trying to import an excel file into Access 97. It looks perfectly all
right but, every time I try to import it, I get to the lst step and am told
that it was not imported due to an error. ...
|
by: optimizeit |
last post by:
What I am attempting to do is import an Excel Workbook and display the
worksheets in a datagrid dynamically.
I am very close to getting this to work. I have to this point
successfully imported a...
|
by: baling |
last post by:
Hi....
Hi everybody, i have a code that i make in VBA and know I want to use this code in to VB6. But i don't know how to use that code in to VB 6.0
Please correct this code so i can use it in VB...
|
by: l2urhwhc4u |
last post by:
Hello,
I really need help with this problem I'm facing. I'm writing a recipe guide program using VBA form. I got to the part where the user can type in an ingredient and I need the program to...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |