Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ExcelSheet question
#2
Create new member function ExcelSheet.Init2 and paste this.

Code:
Copy      Help
function $book [VARIANT'sheet] [activatebook] [activatesheet]

;Same as Init, but also allows you to specify workbook (file name).

;EXAMPLE
;ExcelSheet es.Init2("Book1.xls" "Sheet2")
;


Excel.Application xlApp._getactive
err
,int h=win; act "+Shell_TrayWnd"; act h
,xlApp._getactive

Excel.Workbook wb=xlApp.Workbooks.Item(book)
if(activatebook) wb.Activate

int good
sel sheet.vt
,case [VT_I4,VT_DISPATCH] good=sheet.lVal
,case VT_BSTR good=sheet.bstrVal.len
if(good)
,ws=wb.Worksheets.Item(sheet)
,if(activatesheet) ws.Activate
else ws=wb.ActiveSheet

err+ end _error


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)