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

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
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,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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