View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Easy one: getting the name of a picture

One way:

This returns the number of the last pic (or -1 if none) inserted:

Public Function LastPicNum() As Long
Dim sName As String
With ActiveSheet.Pictures
If .Count 0 Then
sName = .Item(.Count).Name
LastPicNum = CLng(Mid(sName, InStr(sName, " ") + 1))
Else
LastPicNum = -1
End If
End With
End Function

In article ,
"Paul" wrote:

Hi,

I need to insert a picture into excel and then extract the
numeric value from it's default name. For example, if you
create a new workbook and insert a picture, the picture
name will be "Picture 1". I need to extract the "1" from
that name, so that I can assign it to the the starting
value of a loop counter (don't ask...)

TIA
Paul