Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-23-2013, 12:55 PM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Next time, please try to fully define your requirements up front?



Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oFN As Footnote
Dim oRng As Word.Range
Dim strText As String
strText = Selection.Text
If Left(strText, 1) Like "[!?,.;:]" Then
  strText = Left(strText, Len(strText) - 1)
End If
Set oFN = Selection.Range.Footnotes.Add(Selection.Range, , strText & ": ")
Set oRng = oFN.Range
oRng.MoveEnd wdCharacter, -2
oRng.Font.Italic = True
oRng.Collapse wdCollapseEnd
oRng.Move wdCharacter, 2
oRng.Select
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #2  
Old 01-23-2013, 01:15 PM
ndnd ndnd is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Jan 2013
Posts: 5
ndnd is on a distinguished road
Default

Thanks, Greg! I know -- it's just that I was trying to figure out the additional bits for myself, but obviously didn't do very well with that plan! This is perfect, though, and helps me see exactly how it should be done.
Reply With Quote
  #3  
Old 01-06-2015, 09:23 AM
potiphar potiphar is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Jan 2015
Posts: 2
potiphar is on a distinguished road
Default

Apologies for resurrecting this thread. This is almost the macro I need also, but I need endnotes instead of footnotes, and I need the page number of the initial selection to be put before the selected text in the endnote.

From working with this, it looks like I can just change the footnote references to endnote, but how do I put the page number of the selection in the footnote?

Quote:
Originally Posted by gmaxey View Post
Next time, please try to fully define your requirements up front?

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oFN As Footnote
Dim oRng As Word.Range
Dim strText As String
strText = Selection.Text
If Left(strText, 1) Like "[!?,.;:]" Then
  strText = Left(strText, Len(strText) - 1)
End If
Set oFN = Selection.Range.Footnotes.Add(Selection.Range, , strText & ": ")
Set oRng = oFN.Range
oRng.MoveEnd wdCharacter, -2
oRng.Font.Italic = True
oRng.Collapse wdCollapseEnd
oRng.Move wdCharacter, 2
oRng.Select
End Sub
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert a footnote in PPT 2010 YooNaa Kim PowerPoint 1 06-17-2012 12:04 PM
Macro for microsoft Word blukava Word VBA 7 05-27-2012 02:43 PM
Macro to Insert Text Into Cells Having Multiple Lines revans611 Excel Programming 4 10-24-2011 10:15 AM
Formula to select description when code is entered Natasha Excel 1 09-25-2011 12:59 PM
Microsoft Word 2003/footnote compatibility bonanzajellybean Word 1 05-31-2011 03:31 PM

Other Forums: Access Forums

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