Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to Remove Spaces and Quotes from Multiple Part Bodies

Status
Not open for further replies.

jzecha

Aerospace
Jan 20, 2016
235
US
I was on here about a year ago and had help creating a macro that would remove any specified symbol from the part body names.

The line of code i have is this:
Code:
newName = Replace(newName, ".", newCharacter) 'replace all "." with "_"

This works great, I have added multiple similar lines with to the script with other symbols, but I have run into two issues.
1.Code to change spaces to underscores:
Code:
newName = Replace(newName, " ", newCharacter) 'replace all " " with "_"

2.Code to change quotes to underscores:
Code:
newName = Replace(newName, """, newCharacter) 'replace all """ with "_"

Neither of these work, anybody have any ideas how to modify the code to get them to work?
Also, how would i modify my code to just remove specified symbol as opposed to replacing it with an underscore?
 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top