473,386 Members | 1,819 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,386 software developers and data experts.

Importing excel files into Access with spaces and delimiters

Here are two sample file
Header

ID DATE AMT DESCRIPTION

02 11/1/11 25 This is my descrption

Header

ID DATE AMT DESCRIPTION
02 11/1/11 25 This is my descrption

In all cases the file begins with a row space. The header begins on line 2 in excel. The field headers begin on line3 and the data begins on line 4 or in some cases line 5. I need to programmatically remove the headers, account for the blank space and load about 20 files into access using either vba code or a macro. Location of the files would be something like
c:\myfiles\my_file_2003.xls There are about 20 files with the same my_file_yyyy or a different year. I want to pull in all twenty without having to pull each individual one
Apr 13 '11 #1
1 1623
dsatino
393 256MB
The first thing you'll have to do is update your reference library by adding the Microsoft Excel Object Library.

From your VBA code, open Excel. Set up a loop to loop through the files in the folder. Within that loop, open each file in the excel application,process the data, close the workbook but not the application.

To process the data:
If each piece of data is in it's own cell, then just loop through the cells. If the data in each row is in just one cell then you'll have to get a little creative on extracting it. You can use a combination of the the InStr() and Mid() functions.
Apr 15 '11 #2

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

Similar topics

7
by: Bonnie R | last post by:
Hello! I am writing VBA code in Access 97 to import an Excel 2000 Spreadsheet. I had hoped to do this using ODBC, but that was not to be, for who knows what reason. The problem is that I import...
2
by: Don W. Reynolds | last post by:
Hi All, I am sent an excel spreadsheet on a daily basis. Sometimes it contains 10 rows; sometimes it contains over 5000 rows. I copy this spreadsheet into another spreadsheet and verify the...
2
by: Bill Agee | last post by:
I am having difficulting importing an Excel spreadsheet into my Access program using VBA I want to use the last argument to specify the worksheet name which is RTA. I get an error which says that...
3
by: Conrad F | last post by:
Hello All, I know how to import a specific named excel sheet into a datagrid using ADO.NET by setting up a JET connection and then SELECTing data from the sheet. However, for a real world...
2
by: T2 | last post by:
I need some code ideas to import Excel into Access using VB. I need to use VB because the Excel column formats are not always consistent. I'm importing a fairly simple spreadsheet. Any...
1
by: anthony.ting | last post by:
I've written a vba module that takes several .csv files and imports them all into access using a pre-defined specification. All is good if I set the spec up to import the following as text: ...
12
by: elainenguyen | last post by:
I am trying to import a large excel file of more than 4000 records into a table in Acess version 97, but when the importing process is done, it always imported up to record #16383. Does anybody know...
1
by: John Overton | last post by:
I have a new requirement to Import and Export Excel tables into and out of Access 2003. The Excel tables are located on a remote server but I know the path to the Excel Files. Can you please help...
14
by: ALaurie10 | last post by:
I have data in an excel file(s) which is in Accounting format. This means that my feilds are going down the page and the values across. Do I have to change the excel format of the data? this would be...
0
by: Shootah | last post by:
Hi, I have succeeded in adding automated relationships with refference tables after importing an excel file created from a query to an Access database. However I have the following problem: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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 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.