Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Nov 2012
    Posts
    49
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile a few code questions

    Thanks SO MUCH -- very helpful
    Last edited by computerbabyproblems; 2012-11-30 at 16:44.

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Quote Originally Posted by computerbabyproblems View Post
    * 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
    [MS MVP - Word]

  3. #3
    Lounger
    Join Date
    Nov 2012
    Posts
    49
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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
    Last edited by computerbabyproblems; 2012-11-30 at 19:00.

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    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
    [MS MVP - Word]

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    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
    [MS MVP - Word]

  6. #6
    Lounger
    Join Date
    Nov 2012
    Posts
    49
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ......................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.........
    Last edited by computerbabyproblems; 2012-11-30 at 19:02.

Posting Permissions

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