Skip to main content
Participating Frequently
June 20, 2008
Question

Referencing a layer in a set in VB

  • June 20, 2008
  • 3 replies
  • 402 views
I can write text on a layer if it's on the top level. But I can't find the same layer if it's nested in a set.
This works:
Dim docRef
docRef.ActiveLayer = docRef.Layers("topLine")
Set artLayerRef = docRef.ActiveLayer
Set textItemRef = artLayerRef.TextItem
textItemRef.Contents = "blah blah"

If I wanted to write to a layer called "topLine" in the set "mainSet" how would I do this?

TIA

Steve
This topic has been closed for replies.

3 replies

Participating Frequently
June 23, 2008
Brilliant. Thank you, thank you :-)

Now I can even reference a layer in a set, in a set:

SET textItemRef = docRef.LayerSets("Group 1").LayerSets("Group 2").ArtLayers("Layer 1").TextItem

Cool. And at last!

Thank you again, sir.

Steve
MarkWalsh
Inspiring
June 23, 2008
I believe the syntax would be

SET textItemRef = docRef.LayerSets("mainSet").ArtLayers("topLine").TextItem
Participating Frequently
June 23, 2008
Perhaps I've asked this awkwardly? Let me try again, co I know it's a simple answer, but a weekend trawl through the docs and Google has had me pulling my hair out.

This works fine, when the text layer "topLine" is in the top level, that is, not in a layer set:

SET textItemRef = docRef.artLayers("topLine").TextItem
textItemRef.Contents = "blah blah"

But when the text layer is nested in a layer set "mainSet" it cannot be found. I'd like the answer to be something like:

SET textItemRef = docRef.artLayers("mainSet")("topLine").TextItem

But, every combination I've tried fails.

How do I reference a text layer nested in a layer set?

TIA

Steve