1913 Views
I have script below:
On Error Resume Next
Err.Clear 'Clears any earlier error
Set xla = GetObject(, "Excel.Application")
IF Err.Number > 0 THEN
Set xla = CreateObject("Excel.Application")
END IF
ON ERROR GOTO 0 'This turns Off Error Handling
xla.Visible = true
xla.ScreenUpdating = false
for yr = LEAP.BaseYear to LEAP.EndYear
LEAP.ActiveYear = yr
LEAP.ExportEnergyBalanceXLS
next
ShtCnt = xla.Sheets.Count
For i = 1 to ShtCnt
xla.Sheets(i).Name = Cstr(LEAP.EndYear + 1 - i)
Next
xla.Visible = true
xla.ScreenUpdating = true
When I run it, errors appear on line/column: 14,0; says: "Error in script: Object required:'LEAP'
I use LEAP newest version 2012.0.0.56
Are there something wrong with my script? Thank You in advance for your help.
regards,
soeharwinto