Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    May 2003
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have a template with a multiline text box on a user form ("cc" field") The cc field is an enclosed bookmark. Once the form is complete, the following code goes to the bookmark and searches and replaces ^p with ^l .
    This code works fine, but I am prompted with the dialog asking if I would like to search the remainder of the document. How can I avoid that prompt?
    Thanks!

    Selection.GoTo What:=wdGoToBookmark, Name:="cc"
    Set BMRange = ActiveDocument.Bookmarks("cc").Range
    If Len(frmKHLetter.txtCC.Text) > 0 Then
    BMRange.Text = frmKHLetter.txtCC.Text
    ActiveDocument.Bookmarks.Add "cc", BMRange

    Selection.GoTo What:=wdGoToBookmark, Name:="cc"
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = "^p"
    .Replacement.Text = "^l"
    .Forward = True
    .Wrap = wdFindAsk
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Change the line

    .Wrap = wdFindAsk

    to

    .Wrap = wdFindStop

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •