Re: Finding and Inserting
From: Doug Robbins (dkr_at_NOmvpsSPAM.org)
Date: 07/08/04
- Next message: Jezebel: "Re: Find all"
- Previous message: Charles Kenyon: "Re: duplicate post"
- In reply to: Jen: "Finding and Inserting"
- Next in thread: anonymous_at_discussions.microsoft.com: "Re: Finding and Inserting"
- Reply: anonymous_at_discussions.microsoft.com: "Re: Finding and Inserting"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 9 Jul 2004 08:59:33 +1000
The following should do what you want:
Dim tag As Range, question As Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="\[*\]", MatchWildcards:=True,
Wrap:=wdFindContinue, Forward:=True) = True
Set tag = Selection.Range
Set question = Selection.Range.Duplicate
question.End = question.End - 1
question.Start = question.Start + 1
tag.Text = InputBox(question)
Loop
End With
-- Please respond to the Newsgroup for the benefit of others who may be interested. Questions sent directly to me will only be answered on a paid consulting basis. Hope this helps, Doug Robbins - Word MVP "Jen" <anonymous@discussions.microsoft.com> wrote in message news:2881e01c464fb$c1e86ba0$a601280a@phx.gbl... > Hi all. I want to create a macro that will look for words > in the word document that are in [brackets]. Then I want > a prompt to come up that asks for data to be entered to > replace the [brackets]. So for example see the following > sentence . . . > > On behalf of Joe's Company, I am pleased to confirm your > acceptance of our offer of employment as an [insert > title]. > > I want a prompt to come up as ask "insert title". When > the user enters the title "Accountant", for example, the > sentence in the document would read > > On behalf of Joe's Company, I am pleased to confirm your > acceptance of our offer of employment as an Accountant. >
- Next message: Jezebel: "Re: Find all"
- Previous message: Charles Kenyon: "Re: duplicate post"
- In reply to: Jen: "Finding and Inserting"
- Next in thread: anonymous_at_discussions.microsoft.com: "Re: Finding and Inserting"
- Reply: anonymous_at_discussions.microsoft.com: "Re: Finding and Inserting"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|