(Ignore the MonthNumber function, because it will be used in another part of the code)
Code: Select all
VBSTART
Function MonthNumber (cMonth)
Select Case cMonth
Case "JANUARY"
MonthNumber = "01"
Case "FEBRUARY"
MonthNumber = "02"
Case "MARCH"
MonthNumber = "03"
Case "APRIL"
MonthNumber = "04"
Case "MAY"
MonthNumber = "05"
Case "JUNE"
MonthNumber = "06"
Case "JULY"
MonthNumber = "07"
Case "AUGUST"
MonthNumber = "08"
Case "SEPTEMBER"
MonthNumber = "09"
Case "OCTOBER"
MonthNumber = "10"
Case "NOVEMBER"
MonthNumber = "11"
Case "DECEMBER"
MonthNumber = "12"
Case Else
MonthNumber = cMonth
End Select
End Function
Function SheetExists(sheetname)
On Error Resume Next
Set wSheet = xlBook.Sheets(sheetname)
if wSheet Is Nothing Then
SheetExists = False
else
SheetExists = True
End if
On Error Goto 0
End Function
VBEND
//TEST
Let>CurrProgram=C:\Users\Norzil\Desktop\Safeguards Payroll\2015\JANUARY\MONTH END SALARY.xlsx
//TEST
XLOpen>CurrProgram,1,xlBook
VBEval>SheetExists(SEC),Result
XLQuit>xlBook