LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert a picture in to a comment but picture not save on hard disk Pablo Excel Discussion (Misc queries) 0 February 21st 07 03:48 PM
resizing a picture to fit a single cell HELP erical Excel Discussion (Misc queries) 2 January 4th 07 08:51 AM
Resizing cells in a selection without resizing entire sheet Danielle via OfficeKB.com Excel Discussion (Misc queries) 4 August 11th 06 10:06 PM
How to stop Excel2002 auto resizing picture in header from templat lee Setting up and Configuration of Excel 0 December 15th 05 04:41 AM
Picture resizing Gixxer_J_97[_2_] Excel Programming 2 February 9th 05 02:35 PM


All times are GMT +1. The time now is 01:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"