View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Take picture out from excel comment

I provided a reply and code to do this a few days ago when you first posted.

Did you not see that reply?

Here is reply again.........................

To extract all Comments pictures and stack them at F1 and rename to list in
A1:A4 run Comment_Extract macro.

You could combine the two macros into one...........I'm too lazy this
morning.

Note: list of names must match the minimum number of pictures.

Sub Comment_Extract()
Dim cmt As Comment
Dim cmts As Comments
Set cmts = ActiveSheet.Comments
For Each cmt In cmts
With cmt
.Visible = True
.Shape.Select
.Shape.CopyPicture _
Appearance:=xlScreen, Format:=xlPicture
.Visible = False
End With
ActiveSheet.Range("F1").PasteSpecial
Next
Call Rename_Pics
End Sub

Sub Rename_Pics()
Dim Pic As Object
Dim rng As Range
Dim i As Integer
On Error GoTo endit
Set rng = Range("A1")
ActiveSheet.DrawingObjects.Select
For Each Pic In Selection
Pic.Name = rng.Offset(i, 0).Value
i = i + 1
Next Pic
Exit Sub
endit:
MsgBox "there is a picture by that name, re-type a name"
End Sub


Gord Dibben MS Excel MVP

On Wed, 28 Oct 2009 22:19:01 -0700, Rohan
wrote:

Hi All,

Actually my requirement is, in my excel sheet I am having style no and
respective picture those pictures are in comment. Now I want to take this
picture out with particular style no as the picture name

Example
Column A Column B
002893 Picture
234455 picture
009944 picture
990494 picture

After extracting it should be

002893.jpg
234455.jpg
009944.jpg
990494.jpg