Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename pictures in forms

Status
Not open for further replies.

2ks

Technical User
Jan 13, 2007
54
GB
Hi there

I am using a standard excel form that will import pictures from another excel file.

I can get a macro to transfer the image but cannot get a macro to delete the images from a clear data coding. The problem is that every new image obviously creates the next picture number and I do not know how to get the macro to rename to a generic file name before deleting/transferring
 



Hi,

"...but cannot get a macro to delete the images..."

Please post the code that you have used and explain where it fails.

Skip,

[glasses] [red][/red]
[tongue]
 
Will post tomorrow as not in work now.

Thanks for time being
 
I have managed to find something that clears the photos. Code below but unfortunately it deletes the macro button at the same time which I have never ever seen before.

What am I doing wrong? Thanks

Code

Sub clear_AIR()
'
' clear_AIR Macro
' Macro recorded 16/02/2007 by Nikk Watt
'
'
Range("Z7:AG7").Select
Selection.ClearContents
Dim S As Shape
For Each S In ActiveSheet.Shapes
S.Select
Selection.Delete
Next
Range("I6:Q6").Select
End Sub
 



In your loop, you must test for the type of shape that you want. Step thru your loop and use the Watch Window to observe the PROPERTIES of the shape. Then modify your code accordingly.

How to use the Watch Window as a Power Programming Tool faq707-4594

Skip,

[glasses] [red][/red]
[tongue]
 
Code below but unfortunately it deletes the macro button at the same time which I have never ever seen before.
Of course it does. You are instructing VBA to do so.
Code:
Dim S As Shape
For Each S In ActiveSheet.Shapes
    S.Select
    Selection.Delete
Next
For each shape in Shapes...select and delete. Your macro button is a shape. As Skip says, test the shape.

Gerry
My paintings and sculpture
 
Thanks all for your help. Now know what to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top