i am using a button in form to craete Excel Shhets in workbook. I am able to create 3 excel sheets using VB6. I want to create more work sheets . PLz Tell me how to get that? Also the following code is not able to stop executing. It keeps running after creating the excel and saving it. i have to manually stop it.
Private Sub Command1_Click()
Public Sub conn_excel()
Set xl_app = Excel.Application
Set xl_book = Excel.Application.Workbooks.Add
'First Work Sheet Creaation
Set xl_Worksheet1 = xl_book.Worksheets(1)
xl_Worksheet1.Name = "Test Data"
xl_Worksheet1.Rows("1:200").Font.Bold = True
xl_Worksheet1.Range("A1:F200").ColumnWidth = 15
'Second Work Sheet Creaation
Set xl_Worksheet2 = xl_book.Worksheets(2)
xl_Worksheet2.Name = "Coal Analysis"
xl_Worksheet2.Rows("1:200").Font.Bold = True
xl_Worksheet2.Range("A1:F200").ColumnWidth = 15
'Third Work Sheet Creaation
Set xl_Worksheet3 = xl_book.Worksheets(3)
xl_Worksheet3.Name = "Enthalpy Calculation"
xl_Worksheet3.Rows("1:200").Font.Bold = True
xl_Worksheet3.Range("A1:F200").ColumnWidth = 15
xl_app.DisplayAlerts = False
This post has been edited by isitsimple: 15 December 2009 - 05:57 AM