jforbes
asked on
Formatting Excel via VB
I am currently working on an app in Access that uses Excel as the Report Generator, this way my client can edit the report with ease. My question is how can I programmatically format the columns to fit the longest Item, and how can I format a cell with a custom format such as currency/Percentage, an how can I center text in a cell?
Thanks in advance.
-John
Thanks in advance.
-John
ASKER
Sorry I guess I wasn't clear on the last part. I know how to select a range, what method do I call or use once the range is selected to center columns and add custom formats.
Thanks so far the autofit works.
-John
Thanks so far the autofit works.
-John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The easiest way to find out what methods to use in Excel is to record a macro and perform the change. Looking at the automatically generated code will give you a guide to use.
ASKER
Thanks a million, I never would have thought about using a macro, works like a charm. Makes it nice when you are able to cheat honestly for code.
Thanks again.
-John
Thanks again.
-John
mobjXL.Columns("A:Z").Enti
mobjXL.Range("A1").Select