Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-25-2020, 03:08 PM
gmaxey gmaxey is offline Remove all the images in a document, including the new lines Windows 10 Remove all the images in a document, including the new lines Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default


You would want to ensure the anchor range paragraph doesn't contain text:

Code:
Public Sub RelaceAllGraphicsWithNothing()
Dim rngStory As Word.Range
Dim lngJunk As Long
Dim lngIndex As Long
Dim oShp As Shape
Dim oPar As Paragraph
  'Fix the skipped blank Header/Footer problem
  lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType
  'Iterate through all story types in the current document
  For Each rngStory In ActiveDocument.StoryRanges
    'Iterate through all linked stories
    Do
      SrcAndRplInStory rngStory, "^g^p", ""
      SrcAndRplInStory rngStory, "^g^l", ""
      SrcAndRplInStory rngStory, "^g", ""
      For lngIndex = rngStory.ShapeRange.Count To 1 Step -1
        Set oShp = rngStory.ShapeRange.Item(lngIndex)
        If Len(oShp.Anchor.Paragraphs(1).Range) = 1 Then
          Set oPar = oShp.Anchor.Paragraphs(1)
          oShp.Anchor.Delete
          oPar.Range.Delete
        Else
          oShp.Delete
        End If
      Next lngIndex
      'Get next linked story (if any)
      Set rngStory = rngStory.NextStoryRange
    Loop Until rngStory Is Nothing
  Next
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove all the images in a document, including the new lines How do I Remove A Specific Amount of Characters from Lines in a Document? tatihulot Word 5 01-22-2016 05:55 AM
Remove all the images in a document, including the new lines How to Prevent Table of Contents Including Document Details shaaa Word 5 06-10-2015 03:52 PM
How to stop including images as attachment (in other e-mail clients)? TylerSD Outlook 0 12-05-2014 01:56 PM
hard lines across document - can't remove joanieS Word 3 07-30-2013 11:29 AM
Remove all images from a Mac OS X Word 2008 Document? qcom Drawing and Graphics 0 04-23-2011 06:48 PM

Other Forums: Access Forums

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