• Finding a URL in a body of text

    Author
    Topic
    #466141

    Using VBA trying to find text that is also a URL wiithin a body of text. I assume the URl is astyle or something like a style that could be searched for but haven’t dscovered the method or property, anyone know what to use?

    Thank you

    Viewing 2 reply threads
    Author
    Replies
    • #1206748

      Try searching the VBA help for “hyperlink” to give yourself a start. HTH

    • #1206752

      Using VBA trying to find text that is also a URL wiithin a body of text. I assume the URl is astyle or something like a style that could be searched for but haven’t dscovered the method or property, anyone know what to use?

      Thank you

      Hi Jim,

      Try something along the lines of:

      Code:
      Sub Find_URLs()
      ' Macro by macropod
      With Selection.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = "htt[ps]{1,2}:^47^47[^32-^127]{3,}"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
        .Execute
      End With
      End Sub

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

    • #1206825

      Thank you both for the help!

    Viewing 2 reply threads
    Reply To: Finding a URL in a body of text

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: