Excel and Quad WX of 3

Using (or providing) components based on the "Win32" framework

Excel and Quad WX of 3

Postby paulmansour on Sun Jan 01, 2017 6:52 pm

Happy New Year All.

I have a bunch of code that drives Excel, written back before ⎕WX 3. To keep it running I have ⎕wx←1.

I would like to get it to run under ⎕wx←3.

I have the following line of code that that returns a range object by specifying the upper left and bottom right cell addresses of the block of cells, (which then I can set or get the Value2 property):

      ws.Range ws.Cells.Item¨(2 3) (4 6)


I cannot seem to alter this to get it to run under WX 3. I understand that indexers and the item property are now different, but I don't get far. I clearly don't understand, at a minimum, how the cells collection is working.

Can someone give me a little insight here?

Is there documentation that I missed? I read the chapter on OLE, and it discusses some basic stuff with respect to changing from WX 1 to WX 3, but it did not help me rewrite the above line.

Thanks.
paulmansour
 
Posts: 420
Joined: Fri Oct 03, 2008 4:14 pm

Re: Excel and Quad WX of 3

Postby Morten|Dyalog on Sun Jan 01, 2017 8:07 pm

Hi Paul, Happy New Year!

With ⎕WX=3, Range and Cells[.Item] become index-able properties rather than methods. Both collections allows you to index them as if it were 2-dimensional, but the two "indices" that you pass are actually passed as arguments to an underlying get_Range / get_Item "indexer" method:

Code: Select all
      ⍴ws.Range[ws.Cells[1;1];ws.Cells[3;2]].Value2
3 2
      ⍴ws.Range[⊂'B3:D6'].Value2 ⍝ ALternative form
4 3


Hope this helps! I am not sure there was any documentation that explained exactly how this works.
User avatar
Morten|Dyalog
 
Posts: 453
Joined: Tue Sep 09, 2008 3:52 pm

Re: Excel and Quad WX of 3

Postby Vince|Dyalog on Tue Jan 03, 2017 10:00 am

Hi Paul and Morten,

Happy New Year!

It was only mentioned in our 11.0 release notes.

Previously, I have taken the text from our 11.0 release notes and posted it here:

"Why does COM code written for a pre-11 Dyalog stop working?"
http://www.dyalog.com/forum/viewtopic.php?f=22&t=179

Regards,

Vince
Vince|Dyalog
 
Posts: 412
Joined: Wed Oct 01, 2008 9:39 am

Re: Excel and Quad WX of 3

Postby paulmansour on Tue Jan 03, 2017 1:48 pm

Morten,

Thanks!!! That works.

By the way, in both WX 1 and 3, when you get a range for a single cell, if that cell is null, then there is no Value2 property. You can assign it, but you can't reference it. Is that a bug in Dyalog or an unavoidable feature of Excel?

Thanks again!

Paul
paulmansour
 
Posts: 420
Joined: Fri Oct 03, 2008 4:14 pm

Re: Excel and Quad WX of 3

Postby Morten|Dyalog on Wed Jan 04, 2017 10:51 am

It's a design decision: Our original thinking was that VALUE ERROR was the closest APL equivalent to a NULL, but that has proved to be impractical in many circumstances. 2041 I-Beam provides a work-around and allows you to specify what to return in place of NULL or ERROR:

http://help.dyalog.com/15.0/Content/Language/Primitive%20Operators/Override%20COM%20Default%20Value.htm
User avatar
Morten|Dyalog
 
Posts: 453
Joined: Tue Sep 09, 2008 3:52 pm


Return to Windows: GUI, COM/OLE/ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest