#1
|
|||
|
|||
using MS Word Styles with objects
I have several very long documents. They have been set up using MS Word STYLES. Is there a way to insert a developer object (e.g., empty picture place holder) after every instance of a particular style (e.g., Heading 1)? This could either be part of the style or just inserted after each instance.
|
#2
|
||||
|
||||
If you insert such an object in the document, then Cut it (and, presumably, the paragraph break following it) from there to place it in the clipboard, you could use Find/Replace, where:
Find = empty, but Heading 1 Style specified Replace = ^&^c A macro to do the same thing: Code:
Sub Demo() Application.ScreenUpdating = False With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "" .Replacement.Text = "^&^c" .Format = True .Forward = True .Style = wdStyleHeading1 .Wrap = wdFindContinue .Execute Replace:=wdReplaceAll End With End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
You can't do it as part of the style but you can do it with a find and replace.
First create the content you want to add (eg the Picture placeholder) Select that placeholder and the trailing paragraph mark and cut it (to get it into your clipboard. Now open the Find and Replace dialog Find: ^p and include the Format>Style>Heading 1 Replace with: ^&^c This will find the paragraph mark at the end of all Heading 1s and replace it with itself plus your clipboard contents. I see Paul got in first and suggested the same thing...
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia Last edited by Guessed; 07-12-2022 at 04:02 PM. Reason: Gazumped |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Replace Embedded Objects with Linked Objects | hicksi | Word | 3 | 09-29-2021 07:17 PM |
Locking styles in Word using VBA to restrict new styles | cadillac1206 | Word VBA | 1 | 04-21-2020 01:08 AM |
Accessing word objects | Erdanova | Excel | 2 | 12-12-2019 06:11 AM |
Macros to move objects prevents moving same objects with arrow keys | BruceM | Word VBA | 1 | 03-10-2015 08:20 AM |
Convert equation objects to inline objects | sumjoh | Word VBA | 1 | 01-29-2013 08:38 PM |