Link to home
Start Free TrialLog in
Avatar of jc31415
jc31415

asked on

create and populate an Excel file using vb

I would like to create and populate an Excel file.

For example:
   How would I set row 5 to a height of 32.
   How would I change the name of sheet 1 to my sheet.

Is there a good book I could look at to address these questions and may more?
Avatar of byundt
byundt
Flag of United States of America image

Hi jc31415,
Sub Test()
Rows(5).RowHeight = 32
Worksheets("Sheet 1").Name = "my Sheet"
End Sub


Cheers!

Brad
jc31415,
John Walkenbach probably has the best book on Excel VBA for beginners through medium experience. Excel 2003 Power Programming with VBA is the latest version of it. http://j-walk.com/ss/books/index.htm

You ought to investigate the macro recorder. It's a great way to learn the syntax and objects that you need to work with. You access the macro recorder through the Tools...Macro...Record macro menu item. Once you launch the macro recorder, it watches the manual operations and writes VBA code that will execute them. It is then very desirable to edit the VBA code, because the macro recorder almost always includes lots of fluff. It is quite common to shrink a recorded macro by 80% through hand-editing--and the edited code will run much faster as well.
Brad
Avatar of jc31415
jc31415

ASKER

I may have asked this question in the wrong place. I do not want to write a macro that is accessed through Tools.
I want to write OLE code that is external to Excel which creates and populates an Excel file.
jc31415,
I transferred your question to the Visual Basic TA. That should be a better place to get the right assistance.
byundt--Excel TA Page Editor
ASKER CERTIFIED SOLUTION
Avatar of Amritpal Singh
Amritpal Singh
Flag of India 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
Avatar of jc31415

ASKER


    That link was very helpfull. Are you aware of other example that make use of VB OLE commands? I am trying to get as complete a list of OLE commands as possible.