Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Import- Print area

Status
Not open for further replies.

Aelstro

Technical User
Jun 17, 2003
24
US
Hello all,

I am trying to link a sheet from an excel spreadsheet to my database via code.

The code looks like this:

DoCmd.TransferSpreadsheet acLink, 8, "Exports-ASN", MyLocation + "Account Status Notebook\Account Status Notebook.xls", False, "Exports!Print Area"

Now when I run the code it imports cells from about 172-577 (405 records)
If I set up the link myself (right click on table window, choose import, select the file, choose the exports sheet, etc) It comes in with the full number of records (around 630)

Both are listed as Exports!Print area in "C:\Filename" when I hover over them and read the "tool tips" box that comes up.

Anyone know why there is a discrepency between the code and manual linking, and what can be done about it?

 
Ok, here is the solution for my problem, but I still don't understand.

I removed the "Print Area" part and just imported "Exports$"

This successfully grabbed the whole page.

Now, my question is, why is there a print area that is different from the whole page? Can this be set (in either Excel or Access)? How?

Thanks,
Aelstro
 
Yes, the Print Area can be set in the Excel spreadsheet. It is one of the options under File Menu --> Print Area. To use this, simply have the desired area selected, choose, File --> Print Area --> Set Print Area. Only that section will print.
 
Thank you. I learned something new about Excel today. That could come in very handy later.

Aelstro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top