Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Microsoft Word Addin Need it to automaticly activate before save event

Status
Not open for further replies.

DMUM

Programmer
Mar 15, 2012
8
US
Hi, I've created a Word addin that checks the word document for some verbiage. This needs to be activated when the user attempts to save the document (Save or Save As). This is created in the Normal.dot. The vba code works fine when used as a template (not in Normal.dot) but it deos not activate when installed to the addin. How do I get the addin in Normal.dot to activate. BTW I am using Word 2007 Thank you for your help.
 
Huh?

"the addin in Nomal.dot to activate" How is the addin IN Normal.dot?

What do you mean the addin "needs to be activated"?

"The vba code works fine when used as a template (not in Normal.dot) but it deos not activate when installed to the addin."

Installed to the addin? I do not know what you mean by installed to the addin.

Do I understand that there is some hijack of the Save and SaveAs commands? A rewrite that does action? Please post that code.

BTE: If you redirect a builtin command like SaveAs it is global.

 
Hi, Sorry for the confusion...maybe I provided too much info

Basically I have some vba code that on save or save as is suppose to check the document verbiage and search for particular words and make comments. The user needs to have this happen automatically, we do not want them to click on a button and we do not want to use a template which means they have to use a specific word document. We want the code to work in any word document which means (to my understanding) a global addin.

Using this website:
I learned that I needed to add my code to the Normal.dot which I have done, but now the BeforeSaveAs event does not activate when the user clicks SaveAs or Save. I need someway to kick off my code from Normal.dot uless there is a different way to access and addin. If you still need the code, please let me know, I have to send it from my work email is why I'm not adding it here.

Thanks for your help
 
Here is my code:

Option Explicit
Public DocEmpty As Boolean
Public ChangesFound As Boolean

Private Sub appWord_DocumentBeforeSave _
(ByVal Doc As Document, _
SaveAsUI As Boolean, _
Cancel As Boolean)


Call EditingMacroComments

End Sub

Private Sub appWord_DocumentBeforeSaveAs _
(ByVal Doc As Document, _
SaveAsUI As Boolean, _
Cancel As Boolean)


Call EditingMacroComments

End Sub



Sub EditingMacroComments()


'start Letter check of key words
With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="apologize", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please replace with a statement of understanding from the approved verbiage in the ECR Style Guide."
ChangesFound = False
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="advise", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid this word, as prescribed by the ECR Style Guide."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="advised", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid this word, as prescribed by the ECR Style Guide."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="you failed", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please consider rewording to enhance the tone of the letter."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="You failed", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please consider rewording to enhance the tone of the letter."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="You did not", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please consider rewording to enhance the tone of the letter."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="you did not", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please consider rewording to enhance the tone of the letter."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="As you already know", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please consider rewording to 'As we discussed' or simply remove this phrase."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="financials", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please note that 'financials' is not a noun and is slang. Recommended: 'financial information' or 'financial documents.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="the bank", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="If this is in reference to Bank of America, please replace with 'Bank of America.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="the Bank", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="If this is in reference to Bank of America, please replace with 'Bank of America.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="inconsistent information", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="If this is a summary of the complaint, please paraphrase with neutral tone. E.g., 'You expressed dissatisfaction with the quality of your communications with Bank of America.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="apparently", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please consider removing or rewording. We should avoid speculation."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="error", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="If this is in reference to a real or alleged bank error, please consider rephrasing with neutral language. Tip: Just state the fact-no need to classify it as an error."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="husband", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid relational titles. Use each person's name."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="wife", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid relational titles. Use each person's name."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="sister", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid relational titles. Use each person's name."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="brother", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid relational titles. Use each person's name."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="mother", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid relational titles. Use each person's name."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="father", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid relational titles. Use each person's name."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="grandmother", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid relational titles. Use each person's name."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="grandfather", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid relational titles. Use each person's name."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="neighbor", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid relational titles. Use each person's name."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="trail", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please ensure this should not be 'trial.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="Trail", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please ensure this should not be 'Trial.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="show", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please substitute with another verb (indicate, reflect, etc.)."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="shows", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please substitute with another verb (indicates, reflects, etc.)."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="medication", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please ensure this should not be 'modification.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="Medication", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please ensure this should not be 'Modification.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="complaint", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please change to 'inquiry,' 'correspondence,' or 'letter.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="per", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid legalese. Preferred: 'according to' or other rewrite"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="Per", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid legalese. Preferred: 'according to' or other rewrite"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="pursuant", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid legalese. Preferred: 'according to' or other rewrite"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="via", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid Latin terms. Preferred: 'by'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="denied", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please change to 'declined' if possible."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="We see", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please change to 'We found' or 'We discovered.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="It's", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please ensure should not be 'its.' If not, please change to 'it is.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="In our conversation", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="During our conversation"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="in our conversation", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="during our conversation"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="By mistake", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please state the facts and avoid labeling bank actions as a mistake."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="by mistake", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please state the facts and avoid labeling bank actions as a mistake."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="mistakenly", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please state the facts and avoid labeling bank actions as a mistake."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="post", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please change to 'apply' if in reference to a payment or credit."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="posted", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please change to 'applied' if in reference to a payment or credit."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="issue", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please change to 'concern' or 'matter' if in reference to the complaint."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="delete", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please change to 'remove' if possible."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="you are in review", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please reword this to enhance the tone of the letter. Recommended: 'your account is in review'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="you were reviewed", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please reword this to enhance the tone of the letter. Recommended: 'your account was reviewed'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="you were being reviewed", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please reword this to enhance the tone of the letter. Recommended: 'your account was being reviewed'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="you are delinquent", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please reword this to enhance the tone of the letter. Recommended: 'your account is past due'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="you were delinquent", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please reword this to enhance the tone of the letter. Recommended: 'your account was past due'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="you are past due", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please reword this to enhance the tone of the letter. Recommended: 'your account is past due'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="you were past due", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please reword this to enhance the tone of the letter. Recommended: 'your account was past due'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="regret", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please replace with a statement of understanding from the approved verbiage in the ECR Style Guide."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="sorry", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please replace with a statement of understanding from the approved verbiage in the ECR Style Guide."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="you loan", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please ensure this should not be 'your loan.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="Enclosure(s)", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please specify either 'Enclosure' or 'Enclosures' depending on the number of items enclosed."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="fee's", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please remove the apostrophe if this is meant to be the plural of 'fee.'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="e.g.", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid using Latin abbreviations."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="i.e.", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid using Latin abbreviations."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="etc.", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid using Latin abbreviations."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="the fact that", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="It is recommended to rewrite the sentence without these words."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="frustrated", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please consider rewriting to improve the letter's tone."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="frustration", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please consider rewriting to improve the letter's tone."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="confused", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please consider rewriting to improve the letter's tone."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="confusion", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please consider rewriting to improve the letter's tone."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="miscommunication", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please rewrite using a neutral tone."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="miscommunicated", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please rewrite using a neutral tone."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="are not concerned", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please rewrite using the following format: '…you stated that you do not require Bank of America to research or address [the concern(s)]…'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="no longer concerned", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please rewrite using the following format: '…you stated that you do not require Bank of America to research or address [the concern(s)]…'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="no longer a concern", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please rewrite using the following format: '…you stated that you do not require Bank of America to research or address [the concern(s)]…'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="no longer concerns", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please rewrite using the following format: '…you stated that you do not require Bank of America to research or address [the concern(s)]…'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="as you know", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please consider removing this phrase to improve the tone of the letter."
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="In our phone conversation", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="During our telephone conversation"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="in our phone conversation", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="during our telephone conversation"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="you are currently under review", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="your account is being reviewed"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="proof", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid this word, as prescribed by the ECR Style Guide. Recommended: 'evidence'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="In regards to", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid this wording, as prescribed by the ECR Style Guide. Recommended: 'About', 'Regarding' , 'In regard to'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="in regards to", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid this wording, as prescribed by the ECR Style Guide. Recommended: 'about', 'regarding' , 'in regard to'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="not able", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid this wording, as prescribed by the ECR Style Guide. Recommended: 'unable'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="not valid", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid this wording, as prescribed by the ECR Style Guide. Recommended: 'invalid'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="get", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid this wording, as prescribed by the ECR Style Guide. Recommended: 'obtain'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="not sufficient", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid this wording, as prescribed by the ECR Style Guide. Recommended: 'insufficient'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="good through", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please avoid this wording, as prescribed by the ECR Style Guide. Recommended: 'valid through' or 'will expire on'"
Loop 'and look for the next match
End With
End With

With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
Do While .Execute(findText:="polices", _
MatchWildcards:=False, _
MatchWholeWord:=True, _
Wrap:=wdFindStop, _
Forward:=True) = True
'Do what you want with the found text (Selection.Range)
Selection.Comments.Add Range:=Selection.Range, Text:="Please ensure this should not be 'policies.'"
Loop 'and look for the next match
End With
End With

ActiveWindow.View.ShowRevisionsAndComments = True
End Sub

 
1. please use the code tags when posting code

2. yikes!!! The massive use of Selection has to go - it is very inefficient, especially like that. Let me copy your code out and take a look.

 
OK, forget about your text testing for the moment. It can be handled in a fraction of code using Range and arrays to hold the text to test (AND the comment text). I will post that later.

We need to know exactly what you did with the addin. Do you have it loaded on Startup? Are the Subs appWord_DocumentBeforeSaveAs properly setup? What did you do exactly?

 
Here is the code for your text searching and adding comments.
Code:
Sub EditMacroComments()
Dim r As Range
Dim MyText(4) As String
Dim MyComment(4) As String
Dim j As Long
Dim var

MyText(0) = "apologize"
MyComment(0) = "Please replace with a statement of " _
        & "understanding from the approved verbiage in the ECR Style Guide."

MyText(1) = "advise"
MyComment(1) = "Please avoid this word, as prescribed by the ECR Style Guide."

MyText(2) = "advised"
MyComment(2) = "Please avoid this word, as prescribed by the ECR Style Guide."
            
MyText(3) = "you failed"
MyComment(3) = "Please consider rewording to enhance the tone of the letter."

MyText(4) = "You failed"
MyComment(4) = "Please consider rewording to enhance the tone of the letter."

For var = 0 To 4
    Set r = ActiveDocument.Range
    With r.Find
        Do While .Execute(findtext:=MyText(j), Forward:=True) = True
            r.Comments.Add Range:=r, Text:=MyComment(j)
        Loop
    End With
    j = j + 1
    Set r = Nothing
Next
End Sub
This can replace all those Selection range finds. Ugh.

 
Hi, Thanks for your help. I did not create that portion of the code. The business did. I'm just helping to make it into an addin, bbut thank you for the code, I might suggest I change it for them so it won't be so cumbersome to change when they need to.

Back to my issue.

In repsonse to your questions:

1. What are the code tags to be used when posting code - sorry

2. My first attempt to do the addin, I used the windows template addin popo up box. But when I added it, I got the message that it was not the correct format (not sure hat that means)

3. My second attempt, I moved the .dot to my startup folder, I then used the template addin, it was added, but then I get the message that it is unable to open addin.

4. My 3rd attempt was to use the directions at the url
Of course I tried more then 3 times, but every try caused one issue or another. I need to be able to roll this addin out to over 200 users. It needs to jijack(as you stated in your first text) the save as and SAVE event.

Please advise. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top