View Single Post
 
Old 11-05-2017, 01:26 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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:
Code:
Sub UpdateDocuments()
Application.ScreenUpdating = False
Dim strDocNm As String, strFolder As String, strFile As String, wdDoc As Document
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
strDocNm = ThisDocument.FullName
While strFile <> ""
  If strFolder & "\" & strFile <> strDocNm Then
    Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
    With wdDoc
      Call Foot2Inline(wdDoc)
      .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

Sub Foot2Inline(wdDoc As Document)
Dim i As Long, Rng1 As Range, Rng2 As Range
With wdDoc
  For i = .Footnotes.Count To 1 Step -1
    With .Footnotes(i)
      Set Rng1 = .Reference
      Set Rng2 = .Range
      Rng2.End = Rng2.End - 1
      With Rng1
        .Collapse wdCollapseEnd
        .Font.Reset
        .FormattedText = Rng2.FormattedText
        .InsertBefore "[Note " & i & ": "
        .InsertAfter "]"
        .Font.Color = 6299648
      End With
      .Delete
    End With
  Next
End With
End Sub
Note: The above code preserves formatting in your footnotes (e.g. bold italics, etc.).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote