That did it! Thanks a ton for your help!
- edit - Added the rest of the code for the formatting, in case anyone's interested. If anyone has suggestions for better implementation, please let me know.
The .offset(1,0).offset(-1,0) is to get the entire range of some merged cells. A better solution would probably be to just reformat the worksheet I was given to not use merged cells, but eh...
Option Explicit
Sub resizeImage()
Dim r As Range, pos As Long, o As Object
Dim octl As CommandBarControl
Set r = Range(ActiveCell, ActiveCell.Offset(1, 0).Offset(-1, 0))
ActiveSheet.Paste
Set o = Selection
If TypeName(o) <> "Range" Then
If o.ShapeRange.Width > 185.6 Then
o.ShapeRange.Width = 185.6
End If
If o.ShapeRange.Height > 155# Then
o.ShapeRange.Height = 155#
End If
Set octl = Application.CommandBars.FindControl(ID:=6382)
Application.SendKeys "%e~"
Application.SendKeys "%a~"
octl.Execute
Call centerMe(o, r)
End If
End Sub
Sub centerMe(obj As Object, overCells As Range)
With overCells
obj.Left = .Left + ((.Width - obj.Width) / 2)
obj.Top = .Top + ((.Height - obj.Height) / 2)
End With
End Sub