My goal is to read cells from an excel spreadsheet. However the following exampl

Started by santarjoe, September 15, 2014, 02:57:35 PM

Previous topic - Next topic

santarjoe

Im running Winbatch 2004A , and Windows 7, and MS Excel 2010

; This code assumes the XLS column data constant
xlsFilename = AskFilename( "Excel Dialog Example", "C:\test\", "XLS Files|*.XLS|XLSX Files|*.XLSX", "C:\test\MyExcelFile.xls", 1 )
objExcel = ObjectCreate("Excel.Application")
objExcel.Visible = @TRUE
objExcel.Workbooks.Open(xlsFilename)

I get error "3052  - uninitialized variable or undifined function"  on line objExcel = ObjectCreate("Excel.Application")

My goal is to read cells from an excel spreadsheet.  Is this version of Winbatch not able to do this using the above method ?  How would you suggest achieving this goal of mine ? 

Thank you,
Joe

td

The 'ObjectCreate' function is not available in your 10 year old version of WinBatch.  It first appeared around version 2004F or there abouts.  You will need to use 'ObjectOpen' instead.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

santarjoe

Thank you !  The following seems to work.  But now it crashes with " Error 1258: OLE Unknown name " at the line with arrow.   How do I find the Objects Properties and Methods of the Object ?    I can't determine if winbatch is disagreeing with the "Workbooks" or "Open" or ??  Where are these values listed at ?

objExcel = ObjectOpen("Excel.Application")
;objExcel = ObjectCreate("Excel.Application"
objExcel.Visible = @TRUE
objExcel.Workbooks.Open(xlsFilename)   <-----------


Thanks again !
Joe

td

Your old version of WinBatch does not support multiple member via the dot notation. So you need to change

Code (winbatch) Select
objExcel.Workbooks.Open(xlsFilename)

to

Code (winbatch) Select

objWorkbooks = objExcel.Workbooks
objWorkbooks.Open(xlsFilename)
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade