Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-21-2024, 06:22 AM
fd110 fd110 is offline Send text to footnote without losing comment Windows 10 Send text to footnote without losing comment Office 2021
Novice
Send text to footnote without losing comment
 
Join Date: Nov 2023
Posts: 7
fd110 is on a distinguished road
Default Send text to footnote without losing comment

I got a macro from a friend of the site that sends the text to the footer keeping the formatting
Now my problem is that when I have a comment in that text field, I lose that comment
I wanted, if possible, to send the comment to the number of the footnote in the text before sending the text to the footnote, so that I don't lose the comment.

Code:
Sub Macro1()
Dim oRng As Range, oFN As Footnote, rngInner As Range
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(FindText:="\[\[(*)\]\]", MatchWildcards:=True)
Set oFN = ActiveDocument.Footnotes.Add(oRng, , oRng.Text)
Set rngInner = oRng.Duplicate
rngInner.MoveStart Unit:=wdCharacter, Count:=2
rngInner.MoveEnd Unit:=wdCharacter, Count:=-2
oFN.Range.FormattedText = rngInner.FormattedText
oRng.Text = ""
Loop
End With
lbl_Exit:
Set oRng = Nothing
Set rngInner = Nothing
Exit Sub


End Sub


Thank you very much, I have another problem.
I have a number of comments in the text, which will be deleted by moving the text to the footnote.
Is there a way to move those comments, for example, to the footnote number in the main text and not delete them?
Reply With Quote
  #2  
Old 03-21-2024, 06:37 AM
fd110 fd110 is offline Send text to footnote without losing comment Windows 10 Send text to footnote without losing comment Office 2021
Novice
Send text to footnote without losing comment
 
Join Date: Nov 2023
Posts: 7
fd110 is on a distinguished road
Default comment macro

Dim sTemp As String
With Selection.Find
.ClearFormatting
.Text = "\C*\C"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
End With

Do While Selection.Find.Execute
sTemp = Selection.Text
sTemp = Mid(sTemp, 2, Len(sTemp) - 2)
sTemp = Trim(sTemp)
Selection.Text = ""
Selection.MoveEnd Unit:=wdCharacter
Selection.MoveStart Unit:=wdCharacter, Count:=-1
If Selection.Text = " " Then Selection.Text = " "
Selection.Collapse
ActiveDocument.Comments.Add Range:=Selection.Range, Text:=sTemp

Loop
Reply With Quote
  #3  
Old 03-21-2024, 06:39 AM
fd110 fd110 is offline Send text to footnote without losing comment Windows 10 Send text to footnote without losing comment Office 2021
Novice
Send text to footnote without losing comment
 
Join Date: Nov 2023
Posts: 7
fd110 is on a distinguished road
Default change comment macro

I have used this macro for comments
If the last line of this macro can be changed so that it can select the text from the footnote and comment it with the footnote number in the text, my problem will be solved.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Customize footnote reference marks without losing automation RobiNew Word VBA 0 12-20-2023 01:53 AM
Send text to footnote without losing comment Macro to change font size of Footnote Reference in Footnote Text TheBigBoss Word VBA 5 06-10-2022 06:14 AM
Send text to footnote without losing comment Footnote references in the footnote section losing their style when cut+pasted from same doc emblaw Word 4 12-08-2020 06:23 AM
Send text to footnote without losing comment Removing line break and indentation between footnote number and footnote text in Word jaanross Word 5 02-06-2020 12:04 AM
Send text to footnote without losing comment Adding footnote number as part of footnote text NoCalScribe Word VBA 3 07-15-2019 07:20 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:45 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