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:
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?
At work we need an excel file whit a comment photo for each thing as you can see in this example:
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?