Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2023, 06:22 PM
moh moh 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 2021
Novice
VBA - Word macro for selecting text and putting it in footnotes?
 
Join Date: Feb 2023
Posts: 2
moh is on a distinguished road
Cool VBA - Word macro for selecting text and putting it in footnotes?

Hello everybody,

i have an issue with Macros in Word , i tried a lot but i could not solve the problem .

i need Word macro for selecting text and putting it in footnotes.

i have two file ,there are not linked

_Document.docx


_footnote file.txt


i send a real sample in this link on my google drive for download
folder drive has a real sample
need Word macro for selecting text and putting it in footnotes
thanks
Reply With Quote
  #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: 137
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
  #3  
Old 02-14-2023, 12:53 PM
moh moh 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 2021
Novice
VBA - Word macro for selecting text and putting it in footnotes?
 
Join Date: Feb 2023
Posts: 2
moh is on a distinguished road
Default Word macro for selecting text and putting it in footnotes.

thanks for trying to help
unfortunately I am still stuck in this case.
i need vba make this steps

VBA search for digits loop 1 2 3 ... in _Document.docx then search for same start digits _footnote file.txt and selected paragraph text then past into a footnote.

send a real sample in this link on my google drive for download
folder drive ,, for understanding the question
Reply With Quote
  #4  
Old 02-14-2023, 01:09 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: 137
AlanCantor is on a distinguished road
Default

If the footnotes are in a different file than the main document, and that second file is not a Word file, VBA might not be the right tool to automate the task.



A third-party scripting tool, like Macro Express or AutoHotkey, might be a better bet.


However, unless you have hundreds (or thousands) of footnotes, it might be faster to insert the task manually than to automate the task via macros!
Reply With Quote
Reply

Tags
macro vba, word 2003 .docx



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 11:27 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