Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VBA - Excel programming question

Posted on 2006-11-13
1
Medium Priority
?
141 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
JohnBPrice earned 1000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses

730 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