Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Picture name is changin as worksheet is copied

Hi,

This newsgroup is great, I've been using it frequently. Thank you
My problem is that I'm using the code from
http://www.mcgimpsey.com/excel/lookuppics.html
to insert pictures in a worksheet according to a cell value, my chart is on
a separate sheet to lookup the picture number, however when I copy the sheet,
the pictures chage numbers, causing the wrong pictures to be called out.
Any idea what is happening, I tried copying to new sheets with the test file
that's on the McGimpsey site, and the picutes keep their corresponding number.

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Picture name is changin as worksheet is copied

Indeed if you copy shapes (which include Pictures) to another sheet the
original Excel assigned name will change, to say Picture x.

X increments with the number of shapes that have ever been added to the
sheet since the sheet was saved with zero shapes..

Shapes have two names, the Excel assigned name and one that you can assign
yourself, manually in the box on the input bar or with code. If you name the
shape first, when you come to copy to another sheet myName will persist.

So for your purposes name the Pictures before copying to other sheets. Be
careful because for some strange reason Excel permits shapes with duplicate
myName on the same sheet.

Sub test()
Dim pic As Picture
For Each pic In ActiveSheet.Pictures
i = i + 1
pic.Name = "myName_" & Format(i, "00")
Next
End Sub

If by chance you had duplicate myNname's you might be surprised to find you
need to run the above more than once.

Regards,
Peter T

"Franky" wrote in message
...
Hi,

This newsgroup is great, I've been using it frequently. Thank you
My problem is that I'm using the code from
http://www.mcgimpsey.com/excel/lookuppics.html
to insert pictures in a worksheet according to a cell value, my chart is

on
a separate sheet to lookup the picture number, however when I copy the

sheet,
the pictures chage numbers, causing the wrong pictures to be called out.
Any idea what is happening, I tried copying to new sheets with the test

file
that's on the McGimpsey site, and the picutes keep their corresponding

number.

Thanks in advance



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to embed picture that can not be copied or altered? joromajr Excel Discussion (Misc queries) 3 July 19th 08 09:49 PM
Changin a Macro so it automatically updates the active worksheet. Confused Laura Excel Discussion (Misc queries) 1 March 17th 08 11:19 PM
Insert picture and let it automatically be copied to other sheets Aron Excel Worksheet Functions 5 September 24th 07 12:40 PM
How to extract a picture from an Excel worksheet into a picture fi SARANJAI Excel Discussion (Misc queries) 10 June 12th 05 05:00 AM
How name a copied worksheet? David Excel Programming 2 August 5th 03 11:02 PM


All times are GMT +1. The time now is 07:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"