WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: santarjoe on September 15, 2014, 02:57:35 PM

Title: My goal is to read cells from an excel spreadsheet. However the following exampl
Post by: santarjoe on September 15, 2014, 02:57:35 PM
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
Title: Re: My goal is to read cells from an excel spreadsheet. However the following exampl
Post by: td on September 15, 2014, 03:14:04 PM
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.
Title: Re: My goal is to read cells from an excel spreadsheet. However the following exampl
Post by: santarjoe on September 15, 2014, 06:46:13 PM
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
Title: Re: My goal is to read cells from an excel spreadsheet. However the following exampl
Post by: td on September 15, 2014, 10:03:23 PM
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)