![]() |
|
#1
|
|||
|
|||
![]() Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim oFN As Footnote Dim oRng As Word.Range Set oFN = Selection.Range.Footnotes.Add(Selection.Range, , Selection.Text & ": ") Set oRng = oFN.Range oRng.MoveEnd wdCharacter, -1 oRng.Font.Italic = True oRng.Collapse wdCollapseEnd oRng.Move wdCharacter, 2 oRng.Select End Sub |
#2
|
|||
|
|||
![]()
Hi, I had to change
oRng.MoveEnd wdCharacter, -2 (rather than -1), so that the colon was not italicised since we add a whitespace after the colon before that, but apart from that, it works perfectly. Thanks! |
#3
|
|||
|
|||
![]()
A final question -- is it possible to use string manipulation on the selected text before putting it in the footnote? The reason I ask is this: quite often, I have to select a word or phrase with the punctuation that follows, because I want the footnote reference number to appear immediately after the punctuation. However, I don't want the punctuation to appear in the text when it is copied to the footnote -- I just want that unitalicised colon instead. So, I wondered whether there is a way to check the Selection.Text to see if there is a final punctuation, and if there is, to ignore that and copy the rest. Thanks.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
YooNaa Kim | PowerPoint | 1 | 06-17-2012 12:04 PM |
![]() |
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 |
![]() |
Natasha | Excel | 1 | 09-25-2011 12:59 PM |
![]() |
bonanzajellybean | Word | 1 | 05-31-2011 03:31 PM |