Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-12-2022, 02:41 PM
schmitty_k schmitty_k is offline using MS Word Styles with objects Windows 10 using MS Word Styles with objects Office 2021
Novice
using MS Word Styles with objects
 
Join Date: Jul 2022
Posts: 1
schmitty_k is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 07-12-2022, 03:52 PM
macropod's Avatar
macropod macropod is offline using MS Word Styles with objects Windows 10 using MS Word Styles with objects Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 07-12-2022, 04:01 PM
Guessed's Avatar
Guessed Guessed is online now using MS Word Styles with objects Windows 10 using MS Word Styles with objects 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

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
using MS Word Styles with objects 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
using MS Word Styles with objects Macros to move objects prevents moving same objects with arrow keys BruceM Word VBA 1 03-10-2015 08:20 AM
using MS Word Styles with objects Convert equation objects to inline objects sumjoh Word VBA 1 01-29-2013 08:38 PM

Other Forums: Access Forums

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