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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE maybe... accees to excel

Status
Not open for further replies.

scrappe7

Technical User
Jul 30, 2001
82
US
A normal copy/paste will not hold more than 255 characters in excel from access. However, if you do a paste special and choose either unicode, text or CSV as the data type then it will take it ALL in. The Biff5 paste is the best looking option because it allows easier row/column auto resizing but that option takes only the dreaded 255.

You see some fields have 400 or so charcetrs while others have 5 or so, auto fitting is nice to have. I made a macro button that autosizes all the cells on any data but when the paste special is used with anything other than Biff5 my macro just makes each column extra long and the row extra thin so the data-cells get extremly elongated. I am thinking i can just change my macro from an autosizing of the rows/columns to a manual set width (ie column sizes) macro, then wrap the text and auto size only the rows. Should work in theory (haha...heard that one before).

So now the part that needs some work is creating something that after the query creates a new table in access will copy the table and then paste special into an excel file. I could keep the generated query table open and do the output to excel to get the appropriate files open. So all i would need is some kind of code that says:

active table in access, select all, copy
active table in excel, paste special, unicode or the other ones

I could open/close the table, my query, the excel file for output with a simple macro command in access, it is just those few operations from access that i need. if only there were a macro recorder in access. I realize this willl probbaly take OLE code but can it be that bad since i can do most of the opening/closing files from an access macr, right? well what do you think, can it be done?

 
In your Excel workbook...

On a blank sheet of your choice choose Data>Get external data>new database query...choose msaccess* database from the databases tab,
find the path to the desired *.mdb and pick your query or table name from the list of tables and querys...(you pick any or all fields at this point) you can skip the next two options or not , (your choice ) but be sure to return data to msexcel
when you successfully return your query data, you can right click any where in the data and choose an update on open option.

Then, every time you open the excel spread sheet, any updated data in the access .mdb will come in.
 
Are you using office 97 becuase when i go to get external data my choices are run web query, run database query and create new query. Any uggestions as to why we do not have the same options???

Thank you

Ed
 
ETID is talking about CREATE NEW QUERY. From here, you can set up the database Access query. If you need specifics, let me know, but ETID's steps are correct.
 
Hmmmm,...interesting thing, I have office 2K, but my menu reads "New database query"....maybe because of the DSN's I've created previously, who knows ? X-)
 
ETID, its nothing to do with the DSNs. I have 97 and 2000 and they have *slightly* different menus. The 2000 one is as you have stated, whilst the 97 one is as scrappe and I have stated.

We love Microsoft don't we??

Happy New Year all!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top