Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2011, 08:14 AM
ghumdinger ghumdinger is offline ^g for all graphics, what about drawings only? Windows 7 ^g for all graphics, what about drawings only? Office 2010 (Version 14.0)
Advanced Beginner
^g for all graphics, what about drawings only?
 
Join Date: Jul 2010
Posts: 64
ghumdinger is on a distinguished road
Default ^g for all graphics, what about drawings only?

Hi,

I have a 4000 + pages word document with images and drawings. The drawing is actually a grey box that is used to form the background of certain text.

I wish to get rid of the grey boxes. Normally, I would just search and replace all "^g". However, the document has photos as well.

Does anyone know of a way to batch select only the drawings and exclude the photos?



Thanks,
Jay
Reply With Quote
  #2  
Old 06-14-2011, 04:07 PM
macropod's Avatar
macropod macropod is online now ^g for all graphics, what about drawings only? Windows 7 32bit ^g for all graphics, what about drawings only? Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Jay,

Assuming your drawing is a Word rectangle autoshape, you could use code like:
Code:
Sub Demo()
Dim Shp As Shape
With ActiveDocument
  For Each Shp In .Shapes
    If Shp.Type = msoAutoShape Then
      If Shp.AutoShapeType = msoShapeRectangle Then Shp.Delete
    End If
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 06-15-2011, 11:34 AM
ghumdinger ghumdinger is offline ^g for all graphics, what about drawings only? Windows 7 ^g for all graphics, what about drawings only? Office 2010 (Version 14.0)
Advanced Beginner
^g for all graphics, what about drawings only?
 
Join Date: Jul 2010
Posts: 64
ghumdinger is on a distinguished road
Default

Hi Paul,

Thanks for giving it a shot. I've tried the code. It does not work. Perhaps the rectangle I'm dealing with is not an autoshape. I'm not sure how to tell.

Here's a sample of it:

Thanks & warm regards,
Jay
Attached Files
File Type: docx Sample of grey rec.docx (91.4 KB, 11 views)
Reply With Quote
  #4  
Old 06-15-2011, 06:11 PM
macropod's Avatar
macropod macropod is online now ^g for all graphics, what about drawings only? Windows 7 32bit ^g for all graphics, what about drawings only? Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Jay,

The grey shape in your document isn't a single object - it's a large group of other shapes that have had grey shading applied to them. If that's what you've used in all cases, and you have no other grouped shapes, you could use:
Code:
Sub Demo()
Dim Shp As Shape
With ActiveDocument
  For Each Shp In .Shapes
    If Shp.Type = msoGroup Then Shp.Delete
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 06-16-2011, 07:36 AM
ghumdinger ghumdinger is offline ^g for all graphics, what about drawings only? Windows 7 ^g for all graphics, what about drawings only? Office 2010 (Version 14.0)
Advanced Beginner
^g for all graphics, what about drawings only?
 
Join Date: Jul 2010
Posts: 64
ghumdinger is on a distinguished road
Default

Hi Paul,

Ah, so it's a collection of grey rectangles. What a strange way to highlight text.

The macro code worked. Some of the grouped shapes are actually groups of groups and on. Is there a command to instruct Word to run the code until there are no shapes left?

One day I got to pick up a book on macros and start reading up.

Thanks!

Cheers,
Jay
Reply With Quote
  #6  
Old 06-16-2011, 06:24 PM
macropod's Avatar
macropod macropod is online now ^g for all graphics, what about drawings only? Windows 7 32bit ^g for all graphics, what about drawings only? Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Jay,

Do you mean something like:
Code:
Sub Demo()
Dim Shp As Shape
With ActiveDocument
  For Each Shp In .Shapes
    If Shp.Type <> msoPicture Then Shp.Delete
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 06-19-2011, 08:26 AM
ghumdinger ghumdinger is offline ^g for all graphics, what about drawings only? Windows 7 ^g for all graphics, what about drawings only? Office 2010 (Version 14.0)
Advanced Beginner
^g for all graphics, what about drawings only?
 
Join Date: Jul 2010
Posts: 64
ghumdinger is on a distinguished road
Default

Not quite. When I ran the code, I found out that some of the rectangles are acutally groups of groups of ... smaller grey blocks (see attached).

In order to get rid of them all, I could run the code say, 10 times. However, I wondering if there is a command to instruct the code to loop multiple times.

Thanks.
Attached Files
File Type: docx Sample of grey rec.docx (212.0 KB, 11 views)
Reply With Quote
  #8  
Old 06-20-2011, 02:13 AM
macropod's Avatar
macropod macropod is online now ^g for all graphics, what about drawings only? Windows 7 64bit ^g for all graphics, what about drawings only? Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Jay,

Try it this way:
Code:
Sub Demo()
Dim i As Long
With ActiveDocument
  For i = .Shapes.Count To 1 Step -1
      If .Shapes(i).Type <> msoPicture Then .Shapes(i).Delete
    Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 06-22-2011, 08:30 PM
ghumdinger ghumdinger is offline ^g for all graphics, what about drawings only? Windows 7 ^g for all graphics, what about drawings only? Office 2010 (Version 14.0)
Advanced Beginner
^g for all graphics, what about drawings only?
 
Join Date: Jul 2010
Posts: 64
ghumdinger is on a distinguished road
Default

Worked awesome. Thanks Paul!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
^g for all graphics, what about drawings only? listing linked graphics eng1ne Drawing and Graphics 5 02-28-2012 06:42 AM
Combine is duplicating coments and graphics Ulodesk Word 4 05-04-2011 06:10 PM
Need To Lock Colors In Graphics bcicio PowerPoint 3 11-24-2010 07:47 AM
^g for all graphics, what about drawings only? Graphics resolution Roscoe Drawing and Graphics 5 07-02-2010 07:43 AM
find and replace graphics thegeester Drawing and Graphics 0 04-04-2010 04:36 AM

Other Forums: Access Forums

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


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft