Excel comment Picture

R

Rohan

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
 
G

Gord Dibben

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top