I am using following code to export data to Excel
I have few queries regarding above code:Code:Dim oExcel As Excel.Application Dim i Dim ans Set oExcel = CreateObject("Excel.Application") ''Check whether workbook is present in directory ans = Dir$(App.Path & "\reports\DayCollection.XLS", vbNormal) If ans = "" Then MsgBox "Default Excel Workbook was not found. Creating new.", vbInformation oExcel.Workbooks.Add App.Path & "\reports\DayCollection.xls" Else oExcel.Workbooks.Open Filename:=App.Path & "\reports\DayCollection.XLS" End If With oExcel .Cells(1, 5) = "ABC Inc." .Cells(3, 1) = "Day Collection Report " & ProgramDate & " " & Time .Cells(5, 1) = "S No." .Cells(5, 2) = "Related Serials" .Cells(5, 3) = "Reg.No." .Cells(5, 4) = "Visitors" .Cells(5, 5) = "Officer" .Cells(5, 6) = "Total Fees" .Cells(5, 7) = "Visit Time"
(1) If a default Workbook file is not found in the directory, then how to create a new one with desired name.
(2) How to increase the cell width?
(3) How to set Font size and style which I need to display when Excel Worksheet is opened at last?




Reply With Quote