Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2018, 01:34 PM
macropod's Avatar
macropod macropod is offline Macro which finds hyperlinks and replaces them as footnotes Windows 7 64bit Macro which finds hyperlinks and replaces them as footnotes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default


Try the following macro:
Code:
Sub HLnk2FtNt()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, strDocNm As String
Dim wdDoc As Document, h As Long, Rng As Range
strDocNm = ActiveDocument.FullName
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
While strFile <> ""
  If strFolder & "\" & strFile <> strDocNm Then
    Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, _
      AddToRecentFiles:=False, Visible:=False)
    With wdDoc
      For h = .Hyperlinks.Count To 1 Step -1
        With .Hyperlinks(h)
          Set Rng = .Range
          With Rng
            .Collapse wdCollapseEnd
            .Footnotes.Add Rng
            .End = .End + 1
          End With
          Rng.Footnotes(1).Range.FormattedText = .Range.FormattedText
          .Range.Text = vbNullString
        End With
      Next
      .Close SaveChanges:=True
    End With
  End If
  strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub

Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 10-26-2018, 01:35 AM
rabauck rabauck is offline Macro which finds hyperlinks and replaces them as footnotes Windows 10 Macro which finds hyperlinks and replaces them as footnotes Office 2016
Novice
Macro which finds hyperlinks and replaces them as footnotes
 
Join Date: Jul 2018
Posts: 5
rabauck is on a distinguished road
Default

I receive the following error message:
Run-time error '429': ActiveX component can't create object

When Debugged, it points to this line:
Code:
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
Any thoughts?
Reply With Quote
Reply

Tags
hyperlink, macro, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro which finds hyperlinks and replaces them as footnotes Word macro for selecting text and putting it in footnotes mdhg Word VBA 20 03-06-2024 08:07 AM
Macro which finds hyperlinks and replaces them as footnotes Is there a macro to convert superscripted endnotes to active footnotes? mediadesign Word VBA 4 08-20-2018 03:20 PM
creating manuscript w/footnotes from separate documents containing chapters with footnotes-word 2010 Dottie Publisher 0 02-19-2017 03:18 PM
Macro which finds hyperlinks and replaces them as footnotes How can I create a macro to shift the content of all subsequent footnotes up one position? Atfon Word VBA 4 03-29-2016 05:51 AM
Macro which finds hyperlinks and replaces them as footnotes Word doesn't jumps tothe next lane when finds the dash sign!!!! why? Jamal NUMAN Word 3 04-10-2011 02:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:10 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft