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

Exporting to excel

Status
Not open for further replies.

icekube88

Programmer
Nov 27, 2003
16
PH
In exporting database(im using VB connected to a Access DB) to excel how can i format the cell to fit the text when exported.

e.g.
cell A1
------------------
| Some text here |
------------------

what happen when i exported it is like

-----------
| Some tex|
-----------

some word cant be read.
 
Hi,

The Excel macro recorder is your friend in these situations.

The code:
Code:
'Cells.Select 'can be included but isn't necessary
    Cells.EntireColumn.AutoFit
Should do exactly what you want.

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 



Just to be a bit more rigerous, you must also reference the appliation.workbook.sheet for the range you are formatting.

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Agreed Skip, that should avoid any problems with multiple sheets.

Cheers

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
in macro how do you determine the cellname of the cell
e.g. cells(1,1)


what should appear is not the value of the cell but the name which is A1
 
I think this second question has been answered in thread222-1275184
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top