output to excel (1 Viewer)

partizan82

Registered User.
Local time
Today, 17:11
Joined
May 23, 2002
Messages
17
Hello everyone!

I have a code that outputs the rusults from a query to excell... no problem here :cool: ... the problem is that excell does not show the whole record in a cell untill i change the width of the column... So is there any way to automatically adjust the width or maybe the hight of the cell accordingly to the massege size in a cell? plz help... any suggestions will be appresiated!

P.S. Also it would be nice to center columns in excell after update..

Thank you in advance,
Anton
 
Last edited:

SteveM

Registered User.
Local time
Today, 17:11
Joined
May 27, 2002
Messages
11
Anton,

I have just experimented in Excel and the following appears to work.
On the top menu Select format, columns, AutoFit Selection.

hth
Steve
 

partizan82

Registered User.
Local time
Today, 17:11
Joined
May 23, 2002
Messages
17
SteveM,

Thank you for your reply... what you told me i knew before... my question is: can i do it automatically when excell opens up so my users don't have to do it all the time... maybe there is some script i can use in access for excell to do it automaitically...?

P.S. I created a macro in excell that does it... is there any way to refer to it from access vba after excell is open?

Thanks in advance for any help...
Anton
 
Last edited:

partizan82

Registered User.
Local time
Today, 17:11
Joined
May 23, 2002
Messages
17
Thanks everyone the problem was solved by using this code...

DoCmd.OutputTo acOutputQuery, "LeadTime", acFormatXLS, "LeadTime", False

Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Visible = True
ExcelApp.Workbooks.Open ("LeadTime.xls")
ExcelApp.Cells.Select
ExcelApp.Selection.Rows.AutoFit
ExcelApp.Selection.Columns.AutoFit
ExcelApp.Range("A1").Selec

Thanks everyone,
Anton
 

SteveM

Registered User.
Local time
Today, 17:11
Joined
May 27, 2002
Messages
11
Anton,

Thanks for that code, i did not realise this could be automated. It will prove very useful to me.

Thanks Again
Steve
 

Users who are viewing this thread

Top Bottom