Excel error because of macro

marshalxxl

New Member
Joined
Nov 17, 2018
Messages
12
Hello i need your help :
At work we need an excel file whit a comment photo for each thing as you can see in this example:
kwSobuM
https://imgur.com/a/kwSobuM
To do this we use this macro :
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 ("No image selected")
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

The problem is From time to time this error appears and i have to delete all photo`s or use a backup file:

https://imgur.com/a/QCu0jcN - if i click yes i get this "Excel was able to open the file by repairing or removing the unreadable content"
Removed part : /xl/drawings/vmlDrawing1.vml part ( drawing shape )
Do you know how can i solve this?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,215,335
Messages
6,124,326
Members
449,155
Latest member
ravioli44

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