Link to home
Start Free TrialLog in
Avatar of Buck Beasom
Buck BeasomFlag for United States of America

asked on

Late Binding & Formatting Excel from VBA

Using Access 2003.

I've pulled some code off of this site and also gotten some specific advice on doing things like underlining cells, making the contents bold and so forth. (I think the last guy gave up on me.)

I tried using code pulled from Excel macros, but got errors which I was told came from the fact that I was using "Late Binding" and that - as a result - the Excel reference library was not visible to my Access application. That same person suggested a set of numbers to use instead of things like Weight(xlThin) but the numbers didn't work either.

It seems to me that if I can figure out to do "Early Binding" - or whatever it really is - I can manipulate the Excel sheets I am populating using code cut out of Excel Macros and save myself alot of headaches. Can anyone tell me how to do that - or, alternatively, what the proper syntax for handling basic excel formatting commands like underline, bold, column width and so forth?

Thanks.
Avatar of patrickab
patrickab
Flag of United Kingdom of Great Britain and Northern Ireland image

Here's a macro that includes those formatting commands:

Sub Macro1()
    Selection.Font.Underline = xlUnderlineStyleSingle
    Selection.Font.Bold = True
    Columns("A:A").ColumnWidth = 13.88
    Rows("1:1").RowHeight = 22.5
End Sub

When you want the VBA for other simple commands, just switch on the macro recorder, make the formatting changes you want, switch off the macro recorder and then look at the VBA.
Avatar of peter57r
macro recorder?
This ain't XL/Word etc(:-)
ASKER CERTIFIED SOLUTION
Avatar of Markus Fischer
Markus Fischer
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin