Hi all,
I've been through dozens of examples of how to insert a picture into an excel document using VBA and cannot get any of them to work. The one I'm currently working with that seems pretty straightforward isn't working and I can't figure out why. The second line of code is giving me an error- "Object doesn't support this property or method (Error 438)". Here is my code, if anyone knows why it's not working, please help...
Thanks!
I've been through dozens of examples of how to insert a picture into an excel document using VBA and cannot get any of them to work. The one I'm currently working with that seems pretty straightforward isn't working and I can't figure out why. The second line of code is giving me an error- "Object doesn't support this property or method (Error 438)". Here is my code, if anyone knows why it's not working, please help...
Code:
Sub test()
'Add picture to excel
Range("I1").Select
Selection.Pictures.Insert ("C:\Users\barklie.estes\Desktop\timeline.jpg")
'Calgulate new picture size
With xlApp.Selection.ShapeRange
.LockAspectRatio = msoTrue
.Width = 10
.Height = 8
End With
'Resize and make printable
With xlApp.Selection
.Placement = 1 'xlMoveAndSize
'.Placement = 2 'xlMove
'.Placement = 3 'xlFreeFloating
.PrintObject = True
End With
End Sub
Thanks!