How to record keystrokes and mouse clicks in a macro?

komobu

New Member
Joined
Feb 7, 2011
Messages
37
I saw some instructions on placing images in a comment so that when I click on the cell, I can view the image. Here is an example:
1.insert coment
2.view comment
3. right click on the comment then right click the grey border of the comment(not in the comment itself)
4.click format comment
5.choose the colours and lines tab
6.click the color drop down
7.at the bottom select "fill effects"
8.click the picture tab
9. click select picture button
9.choose pic from wherever
10 click all the ok's

Now I would like to record all of this as a macro and place a Macro Button on my toolbar so all I have to do is click it and a directory will pop up asking me to choose the jpg file. Is this possible? any help on creating the macro would be appreciated.



I would also like the same procedure with a webcam image. Is this possible? Thanks for any input.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Did you actual use the macro recorder and see what it produced?
 
Upvote 0
Something like this:
Code:
Sub GetCommentPic()
   Dim PicFile
   PicFile = Application.GetOpenFilename("JPEG files (*.jpg), *.jpg, Bitmap files (*.bmp), *.bmp")
   If PicFile <> False Then
      ActiveCell.AddComment
      ActiveCell.Comment.Shape.Fill.UserPicture PicFile
   End If
End Sub
 
Upvote 0
Rory;

Thanks! That is exactly what I am looking for! What commands would I use to resize the comment? I tried:

ActiveCell.Comment.Size.Height = "2.5"
ActiveCell.Comment.Size.Width = "4.0"

They returned an error.

Also, how can I put the macro on the tool bar?

Thanks again for your help
 
Upvote 0
Code:
With ActiveCell.Comment.Shape
   .Height = 2.5
   .Width = 4
End With
 
Upvote 0

Forum statistics

Threads
1,213,556
Messages
6,114,284
Members
448,562
Latest member
Flashbond

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top