Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Selection.Range.DupliCate.Find Problem

Selection.Range.DupliCate.Find Problem

Scheduled Pinned Locked Moved Visual Basic
help
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sachin Dubey
    wrote on last edited by
    #1

    Hi All I have created a macro to identify a word "and" and highlight it in a word document First Look at my Macro Function Public Sub AmESerialComma() CheckDate TurnOnTrackChanges Call Home With Selection.Find .ClearFormatting .Text = ",[!.]@ and [!.]@." .MatchWildcards = True .Execute Do While .Found With Selection.Range.Duplicate .Find.Execute FindText:=" and " .Start = .Start + 1: .End = .End - 1 .HighlightColorIndex = wdBrightGreen End With .Execute Loop End With Call Home RestoreTrackChanges End Sub My problem is that when it Goes In "With Selection.Range.Duplicate" Loop the first time it Capture "and" & highlight it .but next time "Selection.Range.Duplicate" is always comes Empty..So its going in Infinite Loop... Can Any Body solve this problem,,I think after Highligting the text its not getting out from loop.. Please Show me some way

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups