Hi,
I'm trying to populate several sheets in an Excel Workbook. But it doesn't appear that a subroutine or a function with the workbook parameter is allowed.
When I try to use the workbook object inside the subroutine, there's an error that
Ole object does not exist, or period is used instead of a comma
If I use the workbook object outside of the subroutine, then it works fine.
In the following, wb is the workbook object.
#DefineSubroutine Populate_Sheet( s_Type, s_FileName, wb )
ws = wb.Sheets( s_Type ) ; <-- This is where the error occurs. The is a sheet with the value of s_Type, and this line works outside of the subroutine.
ws.Activate
;...
;...
;...
#EndSubroutine
wb_ThisWorkbook = o_Excel.ActiveWorkbook
wb_ThisWorkbook.SaveAs( "c:\Projects\WinBatch\data\whodat.xlsx" )
s_FileDate = Populate_Sheet( s_Type, s_FileName, wb_ThisWorkbook )