Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Delete earlier 'Picture' version when new picture copied in

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JDaywalt - 21 Mar 2008 15:56 GMT
I have a sheet tab that contains data + one Picture object.  I have a macro
that allows users to copy/paste this data onto a master sheet tab that may be
blank (if it is the first copy), or it may contain previously copied data.  
Over time, the user will likely use this copy/paste process many times.  The
issue is that with each copy/paste, the newest version of both the data &
picture are copied over the previous.  This is no problem for the data as it
just overwrites the previous, however, the picture 'pastes' over the top of
the old one, leaving each previous version underneath.  For example, the
first copy will be labeled as 'Picture 1', the next copy will become 'Picture
2', then 'Picture 3', etc.  Over time, the file will become huge as each
picture object gets stacked on top of the other.  What code can I write that
will help recognize & delete a previous version of the picture if it exists?
Jim Cone - 22 Mar 2008 02:23 GMT
Sub xxx()
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
   If InStr(1, shp.Name, "Picture", vbTextCompare) > 0 Then
      shp.Delete
   End If
Next 'shp
End Sub
Signature

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

"JDaywalt"
wrote in message
I have a sheet tab that contains data + one Picture object.  I have a macro
that allows users to copy/paste this data onto a master sheet tab that may be
blank (if it is the first copy), or it may contain previously copied data.  
Over time, the user will likely use this copy/paste process many times.  The
issue is that with each copy/paste, the newest version of both the data &
picture are copied over the previous.  This is no problem for the data as it
just overwrites the previous, however, the picture 'pastes' over the top of
the old one, leaving each previous version underneath.  For example, the
first copy will be labeled as 'Picture 1', the next copy will become 'Picture
2', then 'Picture 3', etc.  Over time, the file will become huge as each
picture object gets stacked on top of the other.  What code can I write that
will help recognize & delete a previous version of the picture if it exists?

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.