Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Doing manual edits on a 4 digit text number but noticed when I call up the Object info that the name shows the previous text. For example change a text 0401 to 0462. When I do a Object info it still shows 0401 in the name (see attachment). So I want to develop a macro that will change the object info name to match the manual edit. In this case 0462. Here's the macro code I have so far:
Here's the code:
Macro change_name_in_object_info
Define el as Element
Define Text as String
Define output as String
Define text1 as string
el=ActiveDoc.FirstSelectedElement
Select if Type is "Text"
WHILE (Exists (el) = true)
text1=Text
el.info.name = text1
el = el.nextSelectedElement
End While
select none
End Macro
Solved! Go to Solution.
Main issue was you were doing your select after assigning value to el. Try this.
Macro change_name_in_object_info
Define el as Element
Define Temp as string
Select if Type is "Text"
el = ActiveDoc.FirstSelectedElement
While (Exists(el) = true)
Temp = el.text.string
el.Info.Name = Temp
el = el.NextSelectedElement
End While
Select None
End Macro
Main issue was you were doing your select after assigning value to el. Try this.
Macro change_name_in_object_info
Define el as Element
Define Temp as string
Select if Type is "Text"
el = ActiveDoc.FirstSelectedElement
While (Exists(el) = true)
Temp = el.text.string
el.Info.Name = Temp
el = el.NextSelectedElement
End While
Select None
End Macro
Trevor the code you posted worked like a charm. Great as always! Thank you for helping out.