View Single Post
 
Old 03-14-2022, 11:14 PM
Scaffold Scaffold is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Oct 2009
Location: Moscow, Russia
Posts: 36
Scaffold is on a distinguished road
Default

Yes, with pleasure. I can't share the whole project, but the excerpt I'm sending reproduces the problem. I do nothing special with the selected range, just push it into subscript. The problem is that I don't know how to cancel the selection that sticks after the macro finished working. Please find the file "example.docm" in the attachement. The code is the following:
Code:
Sub TestMacro()

    Application.ScreenUpdating = False
    ActiveDocument.PrintPreview
    ActiveDocument.ClosePrintPreview
    
    Dim shp As Shape
    
    For Each shp In ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Shapes
    
        If shp.Type = msoTextBox Then
    
            Set aRng = shp.TextFrame.TextRange
            aRng.MoveStart Unit:=wdCharacter, Count:=1
            aRng.Select
            aRng.Font.Subscript = True
        
        End If
   
    Next
    
    Application.ScreenUpdating = True
        
End Sub
Attached Files
File Type: docm example.docm (25.2 KB, 9 views)
Reply With Quote