Autotext - mass changes using visual basic?
March 11th, 2010Can someone post code to help me accomplish the following?
I want to be able to do a search and replace on all autotext entries. Here is an example:
Autotext1: "Welcome" ~ text = "Thank you for your business"
Autotext2: "Bye" ~ text = "Should you have any questions"
Search for "you" and replace it with "you and your associates"
Thank you in advance for your help.
Greg
Step 1: VB-Load the autotext into a word doc and save it to temp directory.
Step 2: Open the documents and do my manual changes
Step 3: VB-Delete old autotext from Normal.dot and reload individual autotext into Normal.dot
Questions/help: In step 1, how can I surpress the following prompt: "Doc contains links, want to refresh...?" I want that to default to NO and not prompt me.
Questions/help: In step 3, how can I surpress the prompt "do you want to save changes..." I want the default to be YES and not prompt me.
Questions/help: Finally, I can't get the coding correct as a last step to move all my autotext entries out of normal.dot into the correct PS.doc file.
Thank you so much in advance! Greg
Sub PS_changes()
'extract all autotext entries and save them to C:Temp for editing
Selection.WholeStory
ActiveDocument.AttachedTemplate.AutoTextEntries("zz0100").Insert Where:= _
Selection.Range, RichText:=True
ActiveDocument.SaveAs FileName:="c:tempzz0100.doc"
End Sub
Sub PS_changes_2()
'delete all autotext entries in normal.dot
NormalTemplate.AutoTextEntries("zz0100").Delete
'open and save new autotext entries in normal.dot
Documents.Open FileName:="c:tempzz0100.doc"
Selection.WholeStory
NormalTemplate.AutoTextEntries.Add _
Range:=Selection.Range, Name:="zz0100"
ActiveDocument.Close
End Sub
#If you have any other info about this subject , Please add it free.# |