Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-09-2019, 08:00 PM
thiagoafdoria thiagoafdoria is offline Excluding specific signs when transforming texto into footnotes Windows 10 Excluding specific signs when transforming texto into footnotes Office 2019
Novice
Excluding specific signs when transforming texto into footnotes
 
Join Date: Feb 2017
Posts: 18
thiagoafdoria is on a distinguished road
Default Excluding specific signs when transforming texto into footnotes

Hi there!
I use the following macro, which was kindly constructed by macropod:

Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Range, FtNt As Footnote
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "\[\!*\!\]"
    .Replacement.Text = ""
    .Forward = True
    .Format = False
    .Wrap = wdFindStop
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    If .Characters.Last Like "[" & vbCr & vbTab & Chr(11) & Chr(160) & " ]" Then
      .Characters.Last.Font.Reset
      .End = .End - 1
    End If
    Set Rng = .Duplicate
    .Collapse wdCollapseStart
    Set FtNt = .Footnotes.Add(.Duplicate)
    Rng.Start = FtNt.Reference.End
    FtNt.Range.FormattedText = Rng.FormattedText
    Rng.Delete
    If .End = ActiveDocument.Range.End Then Exit Sub
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
End Sub
I'm having trouble making a small change. This macro transforms text between "[!" and "!]" into footnotes. But I'd like to also exclude those signs, "[!" and "!]" in the final result, that is, the content of the footnote. For example:



- In the body: [!This is x.!]
- In the footnote: This is x.

I guess I'd have to write make another line in the macro, but I don't have any idea of what I should write there.
Somebody could help?
Thank's!
Reply With Quote
  #2  
Old 12-09-2019, 09:49 PM
macropod's Avatar
macropod macropod is offline Excluding specific signs when transforming texto into footnotes Windows 7 64bit Excluding specific signs when transforming texto into footnotes 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

You might replace:
Code:
    If .Characters.Last Like "[" & vbCr & vbTab & Chr(11) & Chr(160) & " ]" Then
      .Characters.Last.Font.Reset
      .End = .End - 1
    End If
with:
Code:
    .Characters.First.Text = vbNullString
    .Characters.First.Text = vbNullString
    .Characters.Last.Text = vbNullString
    .Characters.Last.Text = vbNullString
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-18-2019, 08:11 AM
thiagoafdoria thiagoafdoria is offline Excluding specific signs when transforming texto into footnotes Windows 10 Excluding specific signs when transforming texto into footnotes Office 2019
Novice
Excluding specific signs when transforming texto into footnotes
 
Join Date: Feb 2017
Posts: 18
thiagoafdoria is on a distinguished road
Default

Thank you very much!
Reply With Quote
Reply

Tags
footnote, macro

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excluding specific signs when transforming texto into footnotes How to change superscript footnotes into genuine Word footnotes Knounte29 Word VBA 41 01-16-2020 04:48 PM
creating manuscript w/footnotes from separate documents containing chapters with footnotes-word 2010 Dottie Publisher 0 02-19-2017 03:18 PM
mail group excluding jimalton Outlook 0 06-10-2013 04:08 AM
Excluding specific signs when transforming texto into footnotes Excluding tables from Styles coachpienaar Word Tables 4 10-10-2012 03:23 AM
How can i erase these signs? augustin87r Word 2 06-12-2010 09:22 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:23 PM.


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