Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-13-2022, 02:55 PM
zanodor zanodor is offline Changing Recorded Macro Selection/Clipboard Method to Range/FormattedText Method Windows 10 Changing Recorded Macro Selection/Clipboard Method to Range/FormattedText Method Office 2016
Novice
Changing Recorded Macro Selection/Clipboard Method to Range/FormattedText Method
 
Join Date: Jun 2022
Posts: 17
zanodor is on a distinguished road
Default On we go

Quote:
Originally Posted by zanodor View Post
...
This code should be working but it's not:
Code:
Sub Tinkering()
Application.ScreenUpdating = False
Set MyRange = ActiveDocument.Content
With MyRange.Find
        .ClearFormatting
        .Bold = True
        .Font.Size = 14
        .Text = ""
        With .Replacement
          .ClearFormatting
          .Text = "[[^&]]"
          .Font.Size = 14
        End With
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .Execute Replace:=wdReplaceAll
      End With
Application.ScreenUpdating = True
End Sub
I used the Execute by itself not the Do While Found, if that means anything.

It throws an error at Bold, while that parameter looks sound.
On this forum Q'n'A a person has a similar issue but they don't correct the code (he or she gets the usual scolding while it's not his or her fault that sometimes the error is not even on the line pointed at by the debugger, mind you), instead offer a different one so one can never learn one sample routine or have some feeling of merit or self-confidence. Am I seeing a pattern here? Anyway.

It's even possible that the other method which I strive to do is not usable for what I want to do and only the copy formatting method works. I wouldn't rule it out.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Recorded Macro Selection/Clipboard Method to Range/FormattedText Method Range method Find can't find dates jmcsa3 Excel Programming 1 05-02-2020 06:56 AM
Changing Recorded Macro Selection/Clipboard Method to Range/FormattedText Method Title case macro gets a "type mismatch" error at the Instr method marceepoo Word VBA 1 03-05-2020 09:41 PM
Changing Recorded Macro Selection/Clipboard Method to Range/FormattedText Method Number Format Changing in DocVariable method afshin Word VBA 3 08-06-2017 03:21 PM
Number Format Changing in DocVariable method afshin Word 0 08-02-2017 12:26 AM
Best method(s) for entering multiple notes re diverse range of topics WeThotUWasAToad OneNote 0 05-15-2016 02:17 PM

Other Forums: Access Forums

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