Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-30-2023, 10:16 AM
vivka vivka is offline Change superscripts to regular text except footnote marks without using 'Selection.' Windows 7 64bit Change superscripts to regular text except footnote marks without using 'Selection.' Office 2016
Expert
 
Join Date: Jul 2023
Posts: 305
vivka is on a distinguished road
Default

The code in post 4 should change superscripts in the main text leaving footnotes intact. And this is the fastest way (as far as I know).


But (just in case) try this one. It doesn't use With...End With block:

Code:
Sub Superscripts_To_Regular_MainTxt()
 'Change all superscripts to normal text only in wdMainTextStory (1).

   For Each aStory In ActiveDocument.StoryRanges
     If aStory.StoryType = wdMainTextStory Then aStory.Font.Superscript = False
   Next aStory
 End Sub
Reply With Quote
  #2  
Old 09-30-2023, 11:59 AM
Italophile Italophile is offline Change superscripts to regular text except footnote marks without using 'Selection.' Windows 11 Change superscripts to regular text except footnote marks without using 'Selection.' Office 2021
Expert
 
Join Date: Mar 2022
Posts: 563
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

It is really very simple. Just replace Selection with the range you want to find in. For example ActiveDocument.Content which is the same as the MainStory:

Code:
Sub ReplaceSuperscript()
    With ActiveDocument.Content.Find
        .ClearFormatting
        With .Font
            .Superscript = True
            .Subscript = False
        End With
        .Replacement.ClearFormatting
        With .Replacement.Font
            .Superscript = False
            .Subscript = False
        End With
        .Text = "[!^02]"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
        .Execute Replace:=wdReplaceAll
    End With
End Sub
If you need to replace throughout the entire document:

Code:
Sub ReplaceSuperscript()
    Dim story As Range
    For Each story In ActiveDocument.StoryRanges
        With story.Find
            .ClearFormatting
            With .Font
                .Superscript = True
                .Subscript = False
            End With
            .Replacement.ClearFormatting
            With .Replacement.Font
                .Superscript = False
                .Subscript = False
            End With
            .Text = "[!^02]"
            .Replacement.Text = ""
            .Forward = True
            .Wrap = wdFindContinue
            .Format = True
            .MatchCase = False
            .MatchWholeWord = False
            .MatchAllWordForms = False
            .MatchSoundsLike = False
            .MatchWildcards = True
            .Execute Replace:=wdReplaceAll
        End With
    Next story
End Sub
Reply With Quote
  #3  
Old 10-01-2023, 01:55 AM
RobiNew RobiNew is offline Change superscripts to regular text except footnote marks without using 'Selection.' Windows 10 Change superscripts to regular text except footnote marks without using 'Selection.' Office 2016
Competent Performer
Change superscripts to regular text except footnote marks without using 'Selection.'
 
Join Date: Sep 2023
Posts: 231
RobiNew is on a distinguished road
Default

Thanks a lot, Italophile! Your second code is exactly what I need. Thanks again!
Reply With Quote
Reply

Tags
replace, superscript



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change superscripts to regular text except footnote marks without using 'Selection.' Loop through Footnote Reference Marks Ramses505 Word VBA 6 09-21-2023 12:10 AM
Change superscripts to regular text except footnote marks without using 'Selection.' Macro to change font size of Footnote Reference in Footnote Text TheBigBoss Word VBA 5 06-10-2022 06:14 AM
Need to change superscripts to regular text but also add parentheses DCabby Word VBA 4 11-13-2019 09:43 AM
Change superscripts to regular text except footnote marks without using 'Selection.' Convert endnote/footnote to regular text Cobb78 Word 5 07-11-2016 06:23 AM
Change superscripts to regular text except footnote marks without using 'Selection.' Regular (roman) character style doesn't change text to roman kcbenson Word 2 10-16-2014 01:31 PM

Other Forums: Access Forums

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