Edit and Update Textelement in PageLayout with VBA

2217
3
10-11-2011 06:08 AM
KaiApel1
New Contributor
Dear Forum,

I want to Export a MapLayout by Click. I get a value from the click in the map (for example "housekeeper"). Now I have a sub for setting a new Textfield as MapTitle with this value like that Code found here: http://forums.esri.com/Thread.asp?c=93&f=993&t=130438.
Now the code is to place a New Textfield, so when I click to export a new Map I only want to edit the TextField and not to place every time a new one.
The title textfield is the only one in the pagelayout. How can I select the textelements in the pagelayout - I need a hint. thx for the help!
0 Kudos
3 Replies
JamesCrandall
MVP Frequent Contributor
Dear Forum,

I want to Export a MapLayout by Click. I get a value from the click in the map (for example "housekeeper"). Now I have a sub for setting a new Textfield as MapTitle with this value like that Code found here: http://forums.esri.com/Thread.asp?c=93&f=993&t=130438.
Now the code is to place a New Textfield, so when I click to export a new Map I only want to edit the TextField and not to place every time a new one.
The title textfield is the only one in the pagelayout. How can I select the textelements in the pagelayout - I need a hint. thx for the help!



I am unsure if you can actually add a named TextElement to the Layout (so that you can reference it specifically later on to alter the text) -- hopefully someone will show how to do this.  What you can do is delete all of the existing elements and replace them --- lots of work and code, I know, but is a workaround to consider.

Edit:  here is a solution.  Looks like you can set the name property of the textElements that you add to your Layout! 

http://forums.esri.com/Thread.asp?c=93&f=993&t=161720&mc=8#msgid473582
0 Kudos
KaiApel1
New Contributor
So fast - many thx for the link James. I have fixed my code for setting the NameProperty of the Textelement, so I can check, if it set or not and I can edit this one.
0 Kudos
JamesCrandall
MVP Frequent Contributor
So fast - many thx for the link James. I have fixed my code for setting the NameProperty of the Textelement, so I can check, if it set or not and I can edit this one.


Excellent!  Actually, this has me revisiting one of my apps and implementing this very same thing.
0 Kudos