Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 06, 2016, 04:10:40 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Add a word 2010 function to template  (Read 1342 times)

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Add a word 2010 function to template
« on: February 20, 2014, 12:59:00 PM »
How can I add this word function (macro) to the template exactly. I try with no results. I get functioning, but not to save to template for not copy/paste everytime I want to execute the function in a document to extract the hiperlinks.....
For word 2010


This is the code :

Code: Visual Basic [Select]
  1. Function doHL()
  2.  
  3. Dim nd As Document
  4. Dim a As Document
  5. Dim h As Hyperlink
  6. Dim r As Range
  7. Application.ScreenUpdating = False
  8. Set a = ActiveDocument
  9. Set nd = Documents.Add
  10. For Each h In a.Hyperlinks
  11. Set r = nd.Range
  12.  r.Collapse
  13.  r.InsertParagraph
  14.  r.InsertAfter (h.Address)
  15. Next
  16. nd.Activate
  17. Application.ScreenUpdating = True
  18. Application.ScreenRefresh
  19. End Function


Save the function to the normal.dotm or corresponding to have for ever available....
« Last Edit: February 20, 2014, 01:45:27 PM by Contro »

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,605
    • View Profile
    • Donate to Member
Re: Add a word 2010 function to template
« Reply #1 on: February 20, 2014, 05:56:26 PM »
pretty sure you should copy it into the normal.dotm...

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Add a word 2010 function to template
« Reply #2 on: February 20, 2014, 07:58:47 PM »
pretty sure you should copy it into the normal.dotm...

But How ?. I have a headache trying to see how to save the script/macro/VBA file . :-[

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,605
    • View Profile
    • Donate to Member
Re: Add a word 2010 function to template
« Reply #3 on: February 20, 2014, 08:22:13 PM »
open the VBA editor (SHIFT+F11) and copy to the NORMAL document.

if there's no module associated with NORMAL you can copy the module from the existing file, otherwise just copy and paste the code (then SAVE SAVE SAVE)

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,619
    • View Profile
    • Donate to Member
Re: Add a word 2010 function to template
« Reply #4 on: February 21, 2014, 04:48:16 AM »
open the VBA editor (SHIFT+F11) and copy to the NORMAL document.

if there's no module associated with NORMAL you can copy the module from the existing file, otherwise just copy and paste the code (then SAVE SAVE SAVE)

Copy how ?. A step by step ? I am lost.
 :-[