Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-12-2023, 07:16 PM
AlanCantor AlanCantor is offline VBA - Word macro for selecting text and putting it in footnotes? Windows 10 VBA - Word macro for selecting text and putting it in footnotes? Office 2019
Competent Performer
 
Join Date: Nov 2020
Posts: 154
AlanCantor is on a distinguished road
Default

It's not hard to select text via VBA. It's also not difficult to place selected text into a footnote. You won't even have to copy and paste!

One of the questions you might have to ask is how much text do you want to select? A paragraph? A sentence?

Be aware that Word considers "Hello Dr. Honey, how are you?" as two sentences because of the period after "Dr":

"Hello Dr." and
"Honey, how are you?"

This script may not do exactly what you want, but hopefully it will give you ideas. The script selects a sentence and inserts it as a footnote.
Code:
    Dim x As String
    With Selection
        .Collapse       ' Start by collapsing current selection
        .Extend         ' Select the entire sentence
        .Extend
        .Extend
    End With
    Let x = Selection
    Selection.Footnotes.Add Range:=Selection.Range, Text:=x
Reply With Quote
 

Tags
macro vba, word 2003 .docx

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA - Word macro for selecting text and putting it in footnotes? Word macro for selecting text and putting it in footnotes mdhg Word VBA 20 03-06-2024 08:07 AM
Request for a macro to move footnotes (not formatted as footnotes) from end of page to end of doc Pluckedchicken Word VBA 0 09-03-2020 05:21 AM
Modify macro to move only Blue font footnotes into the Text John 4 Word VBA 11 09-01-2020 03:49 PM
VBA - Word macro for selecting text and putting it in footnotes? need help creating a Word macro selecting all and changing font, size, and color thanks marna Word VBA 4 12-18-2018 07:20 PM
Selecting certain text in word nancy Word VBA 4 04-06-2016 04:33 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:07 AM.


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