Re: Finding and Inserting

From: Doug Robbins (dkr_at_NOmvpsSPAM.org)
Date: 07/08/04


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.
>


Relevant Pages

  • Re: Self employment advice?
    ... I'll be leaving my employment in July, and setting up myself as a Sole ... Trader.It is 15 years since I last wasnt in employment, ... that you keep the records yourself and provide an accountant with the ... ensure you are getting all the tax benefits and submit ...
    (uk.business.accountancy)
  • Re: Job offer, given to someone else before I could accept
    ... that the OP received an offer after the interview, ... If someone really wanted the job, he would send off a written acceptance ... immediate response to the offer of a job. ... If you are in employment already then you probably have ...
    (uk.legal)
  • Re: Self employment advice?
    ... I'll be leaving my employment in July, and setting up myself as a Sole ... Trader.It is 15 years since I last wasnt in employment, ... accountant doing the work for me? ...
    (uk.business.accountancy)
  • Re: Self employment advice?
    ... I'll be leaving my employment in July, and setting up myself as a Sole ... Trader.It is 15 years since I last wasnt in employment, ... accountant doing the work for me? ...
    (uk.business.accountancy)