![]() |
Resizing Picture
I have on an Excel spreadsheet (that someone else developed) with a command
button that is assigned to macro -see below, CommandButton1. (The Insert_HPic it mentions is also below). My issue is that macro works fine but I have another spreadsheet that I want to do the same but the placement and resizing of the picture needs to be different. For example in the macro below the picture is resized to 4" Height and 5.33 Width and in the new it needs to be approximately 3.58" H and 4.71" W. I'm a newbie with this so any help would be appreciated. Thx. Private Sub CommandButton1_Click() Range("B6").Select Insert_HPic ("Image1") End Sub Sub Insert_HPic(ImgName As String) ' ' Insert_HPic Macro ' ' ' dlgAnswer = Application.Dialogs(xlDialogInsertPicture).Show Dim Center1, Center2 As Double Selection.Name = ImgName Selection.ShapeRange.IncrementTop 30 Selection.ShapeRange.LockAspectRatio = True Selection.Locked = False If Selection.ShapeRange.Height < Selection.ShapeRange.Width Then Selection.ShapeRange.Width = 410# If Selection.ShapeRange.Height 305# Then Selection.ShapeRange.Height = 288# Center1 = (419 - Selection.ShapeRange.Width) / 2 Selection.ShapeRange.IncrementLeft Center1 Center2 = (306 - Selection.ShapeRange.Height) / 2 If Center1 < Center2 Then Center2 = Center1 Selection.ShapeRange.IncrementTop Center2 Else Wrng = MsgBox("This is a Verticle picture - do you want to set it to 4 inches tall?", _ vbYesNo, "Warning!") If Wrng = 7 Then Selection.ShapeRange.Delete Else Selection.ShapeRange.Height = 305# Center1 = (418 - Selection.ShapeRange.Width) / 2 Selection.ShapeRange.IncrementLeft Center1 Center2 = (306 - Selection.ShapeRange.Height) / 2 If Center1 < Center2 Then Center2 = Center1 Selection.ShapeRange.IncrementTop Center2 End If End If End Sub |
All times are GMT +1. The time now is 09:50 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com