Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2022, 03:07 PM
Guessed's Avatar
Guessed Guessed is offline Using textframe value in comparison Windows 10 Using textframe value in comparison Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Post your code and a sample document. The earlier question was how to select something so it makes no sense to unselect it in the same macro if you do nothing with the selection.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #2  
Old 03-14-2022, 11:14 PM
Scaffold Scaffold is offline Using textframe value in comparison Windows 10 Using textframe value in comparison Office 2016
Advanced Beginner
Using textframe value in comparison
 
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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Document Comparison Thefirstfish` Word VBA 0 04-10-2017 01:07 PM
Comparison (with styles) Macro aarona Word VBA 0 03-03-2017 11:18 PM
Saving & reopening comparison MarshallAbrams Word 0 03-29-2012 06:19 AM
Comparison jumps to end MarshallAbrams Word 2 03-21-2012 04:04 AM
Using textframe value in comparison oshp.TextFrame.TextRange.Font <The specified error is out of range> ghumdinger PowerPoint 5 12-09-2011 10:36 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:38 PM.


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