BrokenLegMike

How to Delete a text element (text box) in an mxd?

Discussion created by BrokenLegMike on Jun 9, 2011
Latest reply on Jun 9, 2011 by BrokenLegMike
I am creating a program to run through a number of mxd's to change some text elements for final delivery to my client. In the process, I want to delete a text element that says "DRAFT" in each .mxd when the program runs.

for textElement in arcpy.mapping.ListLayoutElements(mxd2, "TEXT_ELEMENT"):

    if textElement.text == "DRAFT": 
        del textElement
    else:
        print "No DRAFT"


I tried del textElement and textElement.delete, neither seem to work.

I also tried setting the text box to nothing (ie textElement.text = "") but I need to actually get rid of the text box.

Thanks for any help,
Mike

Outcomes