or this one if you want to scale the height and width independently of each other
Sub ScalePicture2(pic As Shape, hscale As Double, vscale As Double)
pic.LockAspectRatio = False
pic.ScaleHeight factor:=hscale, RelativeToOriginalSize:=msoTrue
pic.ScaleWidth factor:=vscale, RelativeToOriginalSize:=msoTrue
End Sub
Sub test2()
ScalePicture2 pic:=ActiveSheet.Shapes("Picture 1"), hscale:=1.4, vscale:=1.8 'just an example
End Sub
####
However, most of the same commands exist for the InlineShape command, so this macro works!
Sub scale37()
Selection.InlineShapes(1).LockAspectRatio = True
Selection.InlineShapes(1).ScaleHeight = 37
End Sub
####
$pic_inlineimage ->{LockAspectRatio} = “False”;
####
use strict ;
use OLE;
use Win32::OLE::Const "Microsoft Excel";
my ($excel, $workbook, $sheet, $j, $row, $range, $cell_str, $content, $contentb, , $contentc, $width_found, $id, $test_cell_idg );
my ($worktable_name, $jwk, $jr, $sheets_total, $new_wk);
my ($cell_tg, $v_pos, $h_pos, $pic_cur, $image_file_full, $cell_id, $cur_width, $cur_height, $aspect_ratio, $res, $pic2_cur, $asp_pic_lock);
#___ DEFINE EXCEL
$excel = CreateObject OLE "Excel.Application";
#___ MAKE EXCEL VISIBLE
$excel -> {Visible} = 1;
#___ ADD NEW WORKBOOK
$workbook = $excel -> Workbooks -> Add;
$sheet = $workbook -> Worksheets("Sheet1");
$sheet -> Activate;
$image_file_full = "directory and path to image";
$cell_id = "B3";
$cell_tg = $sheet->Range($cell_id);
$v_pos = $cell_tg->Top;
$h_pos = $cell_tg->Left;
# insert picture with top left hand corner at cell_id
$pic_cur = $sheet->Pictures->Insert($image_file_full);