Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default name a picture

Greetings,
I have a picture object in workbook A Sheet 1.
I can programatically copy it from Workbook A Sheet 1 to
Workbook B sheet 1. Is there a method that I can give it
a name, instead of excel naming it picture 107, etc ?

thanks,
D


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default name a picture

Sheet1.Shapes("Picture 107").Name = "MyPicture"

If you post your code, there may be a more direct way of doing it.

--

Vasant



"Darryl" wrote in message
...
Greetings,
I have a picture object in workbook A Sheet 1.
I can programatically copy it from Workbook A Sheet 1 to
Workbook B sheet 1. Is there a method that I can give it
a name, instead of excel naming it picture 107, etc ?

thanks,
D




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default name a picture

Well, once excel pastes the shape into Workbook B, I don't know
(programatically) the name it gave it.
here is one of my macros

Sub reached25()
'
' reached25 Macro
' Macro recorded 3/9/2005 by System Administrator
'

'
Workbooks.Open Filename:= _
"K:\My Documents\carla\imagefile.xls"
ActiveSheet.Shapes("Rectangle 3").Select
Selection.Copy
ActiveWindow.Close
Range("C15").Select
ActiveSheet.Paste
ActiveSheet.Selected.Shapes.Name = "progress"
Selection.ShapeRange.IncrementLeft -67.75
Selection.ShapeRange.IncrementTop 34.5
Range("A1:C1").Select
End Sub

I need to know the name of the shape after the ActiveSheet.Paste, so I
can remove it in a later macro.

thanks,
D

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default name a picture

If it's the last picture that's pasted in the worksheet:

dim myPictName as string
with activesheet
mypictname = .pictures(.pictures.count).name
end with



Darryl Hoar wrote:

Well, once excel pastes the shape into Workbook B, I don't know
(programatically) the name it gave it.
here is one of my macros

Sub reached25()
'
' reached25 Macro
' Macro recorded 3/9/2005 by System Administrator
'

'
Workbooks.Open Filename:= _
"K:\My Documents\carla\imagefile.xls"
ActiveSheet.Shapes("Rectangle 3").Select
Selection.Copy
ActiveWindow.Close
Range("C15").Select
ActiveSheet.Paste
ActiveSheet.Selected.Shapes.Name = "progress"
Selection.ShapeRange.IncrementLeft -67.75
Selection.ShapeRange.IncrementTop 34.5
Range("A1:C1").Select
End Sub

I need to know the name of the shape after the ActiveSheet.Paste, so I
can remove it in a later macro.

thanks,
D

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default name a picture

Hi -

You don't necessarily give the chart a name, but rather the shape that
the chart is embedded in.

I won't dupe all the code he however, once you have copied it to the
clipboard as a picture you can give it a name as you paste it via the
following:

With Workbooks("YourWorkbookNameHere").Activate
With .Sheets("YourWorkSheetHere")
.Cells("YourCellsHere").Select
.Pictures.Paste.Select
Selection.ShapeRange.Parent.Name =
"YourChartNameHere"
End With
End With

Where (obviously) you replace the "YourWorkbookNameHere",
"YourWorkSheetHere" and "YourCellsHere" and "YourChartNameHere" with
your own references.

It took a while to figure out that you don't give the chart a name at
any point, but rather you assign a name to the (object) parent of the
picture, which is a shape. You can then access the shape at any given
point later on when it is given a sensible name.

John

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
Connect a number to a picture bank and import that picture to exce Dennis Hedo Excel Discussion (Misc queries) 1 March 22nd 10 02:17 PM
how do I insert picture into cell so vlookup can return picture? ah Excel Worksheet Functions 1 May 1st 07 04:38 AM
insert a picture in to a comment but picture not save on hard disk Pablo Excel Discussion (Misc queries) 0 February 21st 07 03:48 PM
get a picture width and height without inserting the picture Dorothy Excel Programming 1 January 13th 05 05:06 AM
I know selected picture is a shape but typename says is picture Carlos Lozano Excel Programming 3 July 24th 04 05:44 PM


All times are GMT +1. The time now is 09:21 AM.

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

About Us

"It's about Microsoft Excel"