Solved

VBA - Excel programming question

Posted on 2006-11-13
1
137 Views
Last Modified: 2010-04-30
Hello,
 
I'm maintaining a project that I didn't originally code.  This code lies in an MSAccess import program that imports data from an Excel spreadsheet.

The spreadsheet was originally laid out without using Named Ranges, but this code appears to do something similar to a named range. Ths spreadsheet has column headers in Row 1 and data starting in Row 2.  The Row 1 value for this column M is "Imperial_Or_Metric".

I can't figure out how the following line knows to gather data and where from??  The real issue is I added named ranges for my additions and I added some data definition info in rows 2-4 and now have import data rows starting in row 5 and my MSAccess import program now dies on this line:


DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Imp_UofM", Me.txtPath, True, "Unit_Of_Measure!A1:B65000"


Can someone interpret this line of code and how I can make it get along with NameRanges or at minimal make it start at row 5 of my spreadsheet for actual import data?

Thank You,
JMO9966
0
Comment
Question by:JMO9966
1 Comment
 
LVL 16

Accepted Solution

by:
JohnBPrice earned 250 total points
ID: 17930149
It is hard coded in the "Unit_Of_Measure!A1:B65000", but it is using the field names from the spreadsheet, (the "true")

If you could move the fieldnames into row 5 instead of row 1, you could simply change "Unit_Of_Measure!A1:B65000" to "Unit_Of_Measure!A5:B65000", however, if you need to keep the field names in row 1, you could change it AND change the "True" to "false", but your resulting table would not get the field names.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question