Author Topic: Reading Excel Merged Cells  (Read 434 times)

oradba4u

  • Full Member
  • ***
  • Posts: 107
Reading Excel Merged Cells
« 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

stanl

  • Pundit
  • *****
  • Posts: 1632
Re: Reading Excel Merged Cells
« Reply #1 on: January 06, 2022, 02:52:36 am »

you can try

Code: Winbatch

TheCell=oWS.Cells(RowNum,ColNum)
V = TheCell.MergeArea.Cells(1, 1).Value
 

stanl

  • Pundit
  • *****
  • Posts: 1632
Re: Reading Excel Merged Cells
« Reply #2 on: January 09, 2022, 06:12:44 am »
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.