Hey guys,
I am very new to VBA. I am just trying to create excel application by VBA. It gives me an error: 0
Thanks
I am very new to VBA. I am just trying to create excel application by VBA. It gives me an error: 0
Code:
Private Sub Command27_Click()
On Error GoTo ErrorHandler
Dim xlApp As Excel.Application
Dim myFile As Excel.Workbook
Dim mySheet As Excel.Worksheet
Dim strprocessingLevel As String
If MsgBox("Confirm exporting to Excel?", vbYesNo + vbQuestion) = vbNo Then
Exit Sub
End If
SysCmd acSysCmdSetStatus, "Processing Data to Export...."
'----------------------------------------------- Open Excel application and create new file
strprocessingLevel = "Creating objects"
Set xlApp = CreateObject("Excel.Application")
Set myFile = xlApp.Workbooks.Add
Set mySheet = myFile.Worksheets(1)
With mySheet
strprocessingLevel = "Inserting Header Information"
'Report Header Setup
.Cells(1, 1) = "LeoTV Live - Non Learning Revoceries"
.Cells(2, 1) = "Statement of Charges: Fiscal "
End With
ErrorHandler:
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description, vbExclamation
End Sub
Thanks