Formatting in Excel from VB6
1 answer
There is an easy way to learn how to do something in Excel using code: macro photography.
Because Excel exposes its API through COM interfaces, VBA, VB scripts, and programs written in other languages ββare very similar. So, start a macro, do what you want to automate, open the recorded macro for editing and look at the code.
In your case it will look like this:
Range("B2").Select -- particular cell selection
ActiveCell.FormulaR1C1 = "123" -- cell text fill
Selection.Font.Bold = True -- enabled bold cell style
Columns("B:B").EntireColumn.AutoFit -- autofitted column
This VBA code. VB6 will be much the same except for one thing: you have to do it with the Excel.Worksheet object. Please refer to the following tutorials: http://www.vbforums.com/showthread.php?t=391665 - to find out more.
Good luck!
+5
a source to share