• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Extract a picture embedded in a comment

magic melvin

New Member
Dear Forum,


I have created the macros blow in powerpoint and excel to enable me to save powerpoint slides as jpgs and then import them into excel as comments. It works by first saving a slide as C:Datasource.jpg and then excel imports this picture into the comment in the active cell. This works well but I overwrite the previous slide every time I save a new image. I now need to modify some of the old jpgs stored in the comments


My question is as follows:


Is it possible to create a macro that will extract the jpg from the comment and paste it on the sheet so it can be modified.


Regards

Melvin


Sub SaveAsJpg()


Const desired_slide As Long = 1

Const filename As String = "jpg"

Const graphic_type As String = "jpg"


With Application.ActivePresentation.Slides(desired_slide)

.Export "C:Datasource." & filename, graphic_type


End With


End Sub


Sub Macro1()

Dim cmt As Comment

Dim strPic As String

Dim mycell As Range

Dim myRng As Range


strPic = "C:datasource.jpg"

Set cmt = ActiveCell.AddComment

cmt.Shape.Fill.UserPicture strPic


Set myRng = Selection

For Each mycell In myRng.Cells


mycell.Comment.Shape.Width = 420

mycell.Comment.Shape.Height = 297

Next mycell


End Sub
 
Back
Top