• have code snippet to convert all urls into active hyperlinks? couldnt find

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » have code snippet to convert all urls into active hyperlinks? couldnt find

    Author
    Topic
    #486599

    Thanks SO MUCH — very helpful

    Viewing 2 reply threads
    Author
    Replies
    • #1360195

      * how would you make it so this code (from an old thread on this site) — http://pastebin.com/69EJyBnF — runs persistently, automatically, and permanently so you dont have to run it every time?

      Not possible. The nearest you could get is to have it run automatically (once) when the document is opened or closed.

      * have macro/code snippet to convert all urls into active hyperlinks? couldnt find any on google

      You could use something like:

      Code:
      Sub ActivateHyperlinks()
      Application.ScreenUpdating = False
      With ActiveDocument.Range
        With .Find
          .ClearFormatting
          .Replacement.ClearFormatting
          .Text = "http://[! ]{1,}"
          .Replacement.Text = ""
          .Forward = True
          .Wrap = wdFindStop
          .Format = False
          .MatchWildcards = True
          .Execute
        End With
        Do While .Find.Found
          .Duplicate.AutoFormat
          .Collapse wdCollapseEnd
          .Find.Execute
        Loop
      End With
      Application.ScreenUpdating = True
      End Sub

      * have macro/code snippet to replace all ending periods with a sentence break (like pressing enter)?

      Not possible if you have abbreviations ending in periods (e.g., i.e., etc.)

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

    • #1360376

      1)
      to also replace https:// can you just add Text = “https://[! ]{1,}”

      so it looks like this?

      .Text = “http://[! ]{1,}”
      .Text = “https://[! ]{1,}”
      .Replacement.Text = “”

      2)
      for the ending periods, all docs won’t have abbreviations ending in periods, and for the rare instances if they do, then it’s ok
      i am guessing from looking at the code you would have something like…….
      .Text = “.”
      .Replacement.Text = [enter]”

      obviously i don’t know what im doing.. since im learning python — edx.org udacity.com coursera.org — i may recreate the codes with python — ironpython.net — though i’ll likely be asking for help

      3)
      how long would you estimate an average person would take to learn enough VB to create common macros (say 12 hours per day)? without having any prior programming knowledge, and assuming they had access to quality (quick) learning materials

      • #1360380

        Please don’t edit your posts like you’ve done to #1 in this thread, as it destroys to context of the subsequent replies. Now, the only way anyone get can an idea of what you posted is by reading the excerpts I quoted.

        Cheers,
        Paul Edstein
        [Fmr MS MVP - Word]

      • #1360381

        1. If you have urls in the form of ‘https’, you can do both versions at the same time by using:
        .Text = “htt[ps]{1,2}://[! ]{1,}”

        2. You can do an ordinary Find/Replace, where:
        Find = ‘. ‘
        Replace = ‘.^p’
        (without the quote marks)

        3. That’s like asking “how long is a piece of string”.

        Cheers,
        Paul Edstein
        [Fmr MS MVP - Word]

    • #1360391

      ………………….the excerpts you quoted is exactly what i had…… so thereby the context is actually enhanced by them being in your post. maybe im just too sensitive so nevermind………….

      #2 ‘^p’ without the period was perfect though wasnt a good idea with the links…………………… (helpful on a separate .docx though)

      #3 wasn’t helpful and a really bad metaphor. the question is answerable, and is only asking for your most educated guess. i dont think i’ll come back and ask for help because of that………

    Viewing 2 reply threads
    Reply To: have code snippet to convert all urls into active hyperlinks? couldnt find

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

    Your information: