A brief snippet of VBA in Corel X4---From Code Pane For L = 1 To SlideDoc.Pages(P).Layers.CountSet Lyr = ActiveDocument.Pages(P).Layers(L)K = Lyr.AbsoluteIndexTransferIndex(K) = IIf(ActiveDocument.Pages(P).Layers(L).IsGuidesLayer, 99, L)StopNext L---From Immediate Execution Pane?L;Lyr.Name;Lyr.AbsoluteIndex;K1 Guides 3 7 How can K differ from Lyr.AbsoluteIndex? Anybody have an idea how this can happen? I've never seen anything like this is 30 years of programming.
That's because Page.Layers collection includes only layers local to the page, while Page.AllLayers lists everything including master layers. AbsoluteIndex shows the index of the layer in the AllLayers collection...
I hope this makes sense
Thanks for taking the time for a quick response. AllLayers (which I've blindly skipped by in the autofill menus) has finished the macro I was working on at a stroke.
Obviously, I could use more experience/better documentation re layers. Is comprehensive documentation of CorelDraw/VBA available? I've used the included documentation and help files, as well as material from your Oberon site on occasion with great results. (Thanks!) The substantial effort required to document the object model in detail is not unappreciated.
However inadvisedly I may have cast the layers collections here, the difference between the value of the expression and the value of the variable it's assigned to remains anomalous. Experiments with .Index (instead of .AbsoluteIndex) yielded expected results. This is now an academic point, but a curiousity nontheless.
Thk