Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-26-2019, 11:04 PM
thiagoafdoria thiagoafdoria is offline Preserving formatting when turning footnotes into regular text Windows 10 Preserving formatting when turning footnotes into regular text Office 2019
Novice
Preserving formatting when turning footnotes into regular text
 
Join Date: Feb 2017
Posts: 18
thiagoafdoria is on a distinguished road
Default Preserving formatting when turning footnotes into regular text

Hi!

I'm using the following macro to turn footnotes into delimited fragments between "[!" and "!]" in the body of the text:

Code:
Sub demo()
Application.ScreenUpdating = False
With ActiveDocument
  Do While .Footnotes.Count > 0
    With .Footnotes(1)
      .Reference.InsertAfter "[!" & .Range.FormattedText & "!]"
      .Delete
    End With
  Loop
End With
Application.ScreenUpdating = True
End Sub
Just now I've realized that the formatting, i.e. bold and italics, are not preserved after I run the macro. So if I have, say, "table" in the footnote, that will turn into "table" in the body of the text.
Is that something I could do to make the macro preserve the formatting?
Thank's!


Thiago
Reply With Quote
  #2  
Old 01-01-2020, 04:09 AM
macropod's Avatar
macropod macropod is offline Preserving formatting when turning footnotes into regular text Windows 7 64bit Preserving formatting when turning footnotes into regular text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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 Demo()
Application.ScreenUpdating = False
Dim Rng As Range
With ActiveDocument
  Do While .Footnotes.Count > 0
    With .Footnotes(1)
      Set Rng = .Reference
      With Rng
        .Collapse wdCollapseStart
        .Text = "[!!]"
        .Start = .Start + 2
        .Collapse wdCollapseStart
      End With
      Rng.FormattedText = .Range.FormattedText
      .Delete
    End With
  Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-08-2020, 01:25 PM
thiagoafdoria thiagoafdoria is offline Preserving formatting when turning footnotes into regular text Windows 10 Preserving formatting when turning footnotes into regular text Office 2019
Novice
Preserving formatting when turning footnotes into regular text
 
Join Date: Feb 2017
Posts: 18
thiagoafdoria is on a distinguished road
Default

Excellent! Thank you!
Reply With Quote
Reply

Tags
footnote, formatting

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Preserving formatting when turning footnotes into regular text Changing words with bold and italics and turning "regular" words into italicized and bold ones thiagoafdoria Word VBA 4 12-02-2019 11:41 AM
Preserving formatting when turning footnotes into regular text regular expressions in footnotes loes Word 3 09-04-2019 07:52 AM
Preserving formatting when turning footnotes into regular text Word Problems - text turning to gibberish Dw1 Word 4 06-17-2015 01:07 PM
Preserving formatting when turning footnotes into regular text Regular expressions for text with complex formatting Kreol2013 Word VBA 1 04-12-2013 07:33 PM
Preserving formatting when turning footnotes into regular text regular Expressions Formatting for Search sesproul Mail Merge 1 11-30-2011 05:02 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:49 AM.


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