help with macro

marshalxxl

New Member
Joined
Nov 17, 2018
Messages
12
Sub PictureInCommentSize()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False 'Only one file
.InitialFileName = CurDir 'directory to open the window
.Filters.Clear 'Cancel the filter
'.Filters.Add Description:="Images", Extensions:="*.jpg", Position:=1
.Title = "Choose image"
If .Show = -1 Then TheFile = .SelectedItems(1) Else TheFile = 0
End With
'No file selected
If TheFile = 0 Then
MsgBox ("Mai incearca gogule")
Exit Sub
End If
'Make comment
ActiveCell.AddComment
ActiveCell.Comment.Text Text:=""
ActiveCell.Comment.Visible = False
ActiveCell.Comment.Shape.Fill.UserPicture TheFile
ActiveCell.Comment.Shape.ScaleWidth 3, msoFalse, msoScaleFromTopLeft
ActiveCell.Comment.Shape.ScaleHeight 3, msoFalse, msoScaleFromTopLeft
End Sub

Hello can somebody add in this macro this thing aswell ? : With Selection
.Comment.Shape.SetShapesDefaultProperties
.ClearComments

End With

I want to use both first one works great for inserting the comment and the secound one i need to add so i don`t get the "excel found unreadable content error" because based on xml
i discoverd that my file get`s corrupted everytime when i delete a comment and ithink this will solve the problem (the 2nd macro will solve the problem.
Basically i have no idea how to make them both to work please help
 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Re: help whit macro

I don't see why you would do that, as the part you want to add removes everything you put into the comment in the first section ???

Code:
Sub PictureInCommentSize()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False 'Only one file
.InitialFileName = CurDir 'directory to open the window
.Filters.Clear 'Cancel the filter
'.Filters.Add Description:="Images", Extensions:="*.jpg", Position:=1
.Title = "Choose image"
If .Show = -1 Then TheFile = .SelectedItems(1) Else TheFile = 0
End With
'No file selected
If TheFile = 0 Then
MsgBox ("Mai incearca gogule")
Exit Sub
End If
'Make comment
With ActiveCell
.AddComment
.Comment.Visible = False
.Comment.Shape.Fill.UserPicture TheFile
.Comment.Shape.ScaleWidth 3, msoFalse, msoScaleFromTopLeft
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,131
Messages
6,123,223
Members
449,091
Latest member
jeremy_bp001

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