I have some powerbuilder code that opens a spreadsheet and writes out some information. My problem is that I want to add additional sheets in Excel and then make them active. The example code that I have seen always uses a number to refer to a spreadsheet as follows:
xlsub = xlapp.Application.ActiveWorkbook.Worksheets
That works fine. But now I am trying to substitute the number '1' for a variable called newsheet. I am getting an 'ANY' / 'LONG' conversion error.
Here is my code:
//now add additional sheets and rename the tabs to coincide with the voucher number
For r = 1 to numrows
voucher = trim(dw_2.getitemstring(r, "voucher_no"))
if not isnull(voucher) then
newsheet = xlapp.Application.ActiveWorkbook.Worksheets.add()
xlsub = xlapp.Application.ActiveWorkbook.Worksheets[newsheet]
Any help would really, really be appreciated...