To check the size in bytes of your pictures, use the "FileLen()" function of VBA:
Sub Check_pic_size(mypic)
Set mypic = ActiveSheet.Shapes.AddPicture(pp, msoFalse, msoTrue, ActiveCell.Left, ActiveCell.Top, -1, -1)
If FileLen(pp) > 100000 Then
MsgBox ("The size of your file is too big, please reduce to 100,000 bytes. Current size is " & FileLen(pp) & " bytes.")
mypic.Delete
Exit Sub
End If
If FileLen(pp) > 100000 Then
MsgBox ("The size of your file is too big, please reduce to 100,000 bytes. Current size is " & FileLen(pp) & " bytes.")
mypic.Delete
Exit Sub
End If
End Sub
Created by DoMyExcel.com © | Excel & VBA Consulting | Customized Excel Solutions starting at 29 USD
No comments:
Post a Comment