Lee Mac Posted April 11, 2009 Posted April 11, 2009 Just a quick question - is there a way to cycle through a variant, as one does with a collection using vlax-for? I thought maybe: (foreach x (vlax-safearray->list (vlax-variant-value <Variant>)) ;; Do Something ;; ) But I just wondered if this was the only way to perform this type of operation. Thanks Lee Quote
wizman Posted April 11, 2009 Posted April 11, 2009 lee, that's the easier way for manipulating variants which is by converting it directly to a list thru (vlax-safearray->list) . The other way could be writing a routine which require some coding: 1. converting variant to safearray(vlax-variant-value), 2. getting its dimension(vlax-safearray-get-dim), 3. getting the bounds (vlax-safearray-get-l-bound/u-bound) for each dimension, 4. and using (vlax-safearray-get-element) for each element in the bound Quote
Lee Mac Posted April 11, 2009 Author Posted April 11, 2009 Ahh, I understand Wizman - just extracting each element individually. I just thought there might be a way to cycle through the elements directly, without having to go through the conversion - but thanks for the suggestion it is much appreciated Lee Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.