|
-
March 19th, 2001, 11:01 PM
#1
Excel new workbook
I would like to open a new workbook in excel in my VB programme. I am currently able to open a already present workbook using the statement:
Xlapp.workbook.open (cdsave.filename) where cdsave is my dialogue box.
I would like to have the similiar ability to open a new workbook with a filename entered in my common dialogue box.
Is there a similiar method available?
Thanx a lot.
-
March 20th, 2001, 08:03 AM
#2
Re: Excel new workbook
Dim ApExcel As Object 'To open Excel
Set ApExcel = CreateObject("Excel.application") 'Creates an object
ApExcel.Visible = True ' So you can see Excel
ApExcel.Workbooks.Add 'Adds a new book.
ApExcel.cells(1, 1).Formula = "HELLO" 'Add Text to a Cell
'You can use the line above, changing coordenates to go to any
'cell and you can also add Formulas
ApExcel.Range("A1:Z1").BORDERS.Color = RGB(0, 0, 0) 'Use it to
'change the borders.
ApExcel.Columns("A:AY").EntireColumn.AutoFit 'To adjust the
'column's width.
ApExcel.Range("A:Z").Select 'To establish a selection
ApExcel.Selection.NumberFormat = "0" 'Adding different formats
At the end save the vorkbook with the name you want
Iouri Boutchkine
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|