Copy link to clipboard
Copied
I am writing a code in VBA to replace a text on a few layers in PSD file and so far I can open PSD, but I cannot select a layer by name. All that I found is that I should use PSDoc.ArtLayers.GetByName("Layer Name"), but that "GetByName" does not exists in VBA.
Then I tried looping through layers and then I found out there is no Layers.Length - that "Length" does not exists.
Basically I have group "Text" and layer "Layer 1". This is the closest I get, but this does not work:
PsDoc.ActiveLayer = PsDoc.ArtLayers.GetByName("Layer 1")
Does anyone knows how to select a layer by name using VBA (or VB)?
Found it, by trials and errors:
PsApp.ActiveDocument.ActiveLayer = PsDoc.LayerSets.Item(1).Layers("Layer 1")
Copy link to clipboard
Copied
Reading your post made my head hurt....
Copy link to clipboard
Copied
Very usefull comment. VERY. Congratulations.
Copy link to clipboard
Copied
For Photoshop there's vbscript (VBS), not VB(A).
Copy link to clipboard
Copied
My question was about VBA, please read the full post, not just title, and I found the solution (last message in this thread).
Copy link to clipboard
Copied
My point is this forum is for as, vbs and js than python, c or vba, and I didn't miss your post 😉
Copy link to clipboard
Copied
Found it, by trials and errors:
PsApp.ActiveDocument.ActiveLayer = PsDoc.LayerSets.Item(1).Layers("Layer 1")