WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: oradba4u on January 05, 2022, 10:23:40 PM

Title: Reading Excel Merged Cells
Post by: oradba4u on January 05, 2022, 10:23:40 PM
All:
Does anyone have experience reading Excel merged cells using WinBatch? I'm trying to read text and all I get back is the value 28.0 (whatever that means)
No matter where I click in the merged cells in Excel, It always tells me that I'm in the upper-left most cell of the group (that makes sense), but I get this strange number (28.0) back when I go to that cell and perform a read:

TheCell=oWS.Cells(RowNum,ColNum)
WholeStr=TheCell.value
Message("The cell value is:",WholeStr)

Also, can all the lines of the merged cells be read as one value (WinBatch variable) crlf included, as if it's a paragraph with many lines?

Any suggestions would be greatly appreciated
Title: Re: Reading Excel Merged Cells
Post by: stanl on January 06, 2022, 02:52:36 AM

you can try

Code (WINBATCH) Select


TheCell=oWS.Cells(RowNum,ColNum)
V = TheCell.MergeArea.Cells(1, 1).Value
Title: Re: Reading Excel Merged Cells
Post by: stanl on January 09, 2022, 06:12:44 AM
Quote from: oradba4u on January 05, 2022, 10:23:40 PM
Also, can all the lines of the merged cells be read as one value (WinBatch variable) crlf included, as if it's a paragraph with many lines?


Would have to see an example of what you are talking about. Putting lf or crlf in Excel cells is really dangerous, especially if data is exported as text. Long text is best suited for word-wrap or text box.