473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to import data from named ranges in Excel 2003 into Access?

I have no hair left with this issue! I'm simply trying to import data from named ranges in Excel 2003, into tables of the same name in Access 2003. I have found that unless I have the spreadsheet from which I want to import, OPEN, the named ranges cannot be found. I can't even see them trying to manually import the data, unless the spreadsheet is open!

I don't want the spreadsheet open because that causes an instance of Excel to remain active, as viewed in Windows Task Manager/Processes (another issue, but what started this whole long nightmare).

I have used variations of this code many times over the years, but now it doesn't work. I have installed Office 2007 converters, which I'm wondering if is causing this issue. Here's the line of code that fails:
[DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "tmp" & tbl, FileName, True, rng]

tbl = a string that is the name of a table in Access, and also a named range in Excel. "tmp" & tbl is a temporary file which holds the import. All field names are identical in the spreadsheet and the Access tables.
Filename is the path and name of the spreadsheet.

Please help!!
Jan 24 '11 #1
11 10002
ADezii
8,834 Expert 8TB
The following Code will Import a Named Range, in an Excel Spreadsheet, into an existing Access Table. The Spreadsheet need not be 'Open' for this process to occur successfully.
Expand|Select|Wrap|Line Numbers
  1. '************* Define Your Own Constants *************
  2. Const conFILE_PATH As String = "C:\Test\Test.xls"
  3. Const conRANGE_NAME As String = "Test_Range"
  4. Const conTABLE_NAME As String = "Table1"
  5. '*****************************************************
  6.  
  7. DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, conTABLE_NAME, conFILE_PATH, True, conRANGE_NAME
Jan 25 '11 #2
ADezii, that code is no different than what I had posted. I get the same error running it as I did with mine. Yet when I have the spreadsheet open, it runs just fine. THAT is the problem!

Thanks for trying,
Laurel
Jan 25 '11 #3
ADezii
8,834 Expert 8TB
  1. What is the Range Assignment for the Variable rng?
  2. Does the 1st Row of the Spreadsheet have Field Names?
  3. Out of curiosity, can you Upload the Spreadsheet stripped of any confidential information?
Jan 25 '11 #4
1. Range assignment is a string, identical to the table to which it will ultimately be appending in Access. An example is "tblFacility". The transferspreadsheet method creates a temporary table of the same name, but with the 'tmp' prefix.
2. The first row of each named range has field names
3. I would upload the spreadsheet except that I see no way to do so: the allowed extensions are picture-types or docs or txt.
Jan 25 '11 #5
ADezii
8,834 Expert 8TB
.zip the Spreadsheet, then Upload it. I'll have a look later today.
Jan 25 '11 #6
Thanks for staying with me on this. BTW, I'm using Office 2003, but with Office 2007 converters loaded.
Jan 25 '11 #7
Another piece of info: this works seamlessly in Office 2010, if I save the file first as a .xlsm type, and then specify the spreadsheet type as 12. However, if I try to do the import in Access 2010 of spreadsheet type 8 or 9, with the older version of the Excel spreadsheet, it can't find the named range!
Jan 25 '11 #8
ADezii
8,834 Expert 8TB
Very strange behavior, Laurel.
Jan 25 '11 #9
It seems as though it's an Access problem. When I imported my entire database into Access 2010, the same thing occurred: could see named ranges of .xlsm files, but not .xls files. For various backward-compatibility issues, I do not choose to develop in 2010. ARGHH!
Jan 25 '11 #10
ADezii
8,834 Expert 8TB
That's why the only Access Version that I use is 2003! (LOL).
Jan 25 '11 #11
Unfortunately, the Rest of the World is moving on, including my coworkers and associates. Therefore the need for up-converters, which I fear have ruined Office 2003.
Jan 25 '11 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Noozer | last post by:
We've created a new database and need to import the data from our old database. Both are MS Access databases and each have multiple tables. The table structure of each table is completely different...
1
by: S. van Beek | last post by:
Dear reader, Is there somebody who can tell me the VBA code for the following action? To import data from an Excel sheet by referring to a cell name in the Excel sheet.
3
by: Schultz | last post by:
I would like to know if it is possible to import data from MS Excel 2000 to a dataset using asp.net. The excel file would need to be uploaded to the server from a web page first, before the loaded...
4
by: greg | last post by:
Hi, I have a read only access file with a linked table that connects to a sybase database. So I can still add data to the table even though its read only since the table is really in sybase. ...
0
by: naresh090183 | last post by:
hi to all Am new to this community. can anyone suggest me how to export data from oracle to Ms-Access using forms6i.I have exported data from oracle to Excel and Ms-Word but I cannot able to find a...
3
by: MarcGA | last post by:
(Excel 2003, Access 2003, XP, novice user here) I can't get Access to accept multiple Excel files to the same table. I can import the spreadsheets to a new table, but I need to import 23...
10
by: booboo | last post by:
If someone would tell me if there is a simple or any way to import data from only one field in an Excel spreadsheet to a table field ?
0
by: tacofinger | last post by:
Hi, How to import MS Query result to Access Table? I have one MS query result from oracle ODBC and total record is 100ku records. I have tried to use link table from Access -import function but it...
1
by: yemyem | last post by:
Hi Guys, im new to the c# language and im liking it so far. What im currently trying to do is write a windows form application so that when the user clicks on a button the application will read...
6
by: Kelly Armstrong | last post by:
Hi, I am very new to VBA and am trying to set up an import from excel into access. Both are the 2010 version. I pulled the code I am using from a previous thread posted by a user trying to do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.