Macro to insert Comment Bubbles on selected text in Microsoft Word?

خرید بک لینک

I'm new to VBA and would greatly appreciate some help on a problem.

I have long Word documents where I need to apply standard Idea to the same set of keywords, but only in selected sections of the document. The following macro worked to find a keyword and apply a comment, but I'm having trouble making some modifications:

Sub item_wording()
'
' item_wording Macro
'
'
Do While Selection.Find.Execute("keyword1") = True
    ActiveDocument.Comments.Add range:=Selection.range, Text:="comment for first keyword"
Loop

End Sub

The two modifications are:

1) only apply the Idea to user selected text, not the whole document. I tried a "With Selection.Range.Find" approach but I don't think Idea can be added this way (??)

2) repeat this for 20+ keywords in the selected text. The keywords aren't totally standard and have names like P_1HAI10, P_1HAI20, P_2HAI60, P_HFS10, etc.

I've combed through previous questions and the Office Dev Center and am stuck. Any help/guidance is greatly appreciated!

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: macro to insert rows,macro to insert blank rows,macro to insert column,macro to insert multiple rows in excel,macro to insert formula into cell,macro to insert text,macro to insert text in excel,macro to insert a row in excel,macro to insert pivot table,macro to insert date in excel, نویسنده: استخدام کار بازدید: 526 تاريخ: دوشنبه 25 مرداد 1395 ساعت: 21:38

صفحه بندی