View Full Version : adding/sizing images.
How do i add and size an image?
MacroRecorder gave me some code, but not exactly what i need.
ActiveSheet.Pictures.Insert ("C:\Documents and Settings\xxx\My Documents\CWI.bmp")
This adds a picture, but how can size it to:
Height: 1.13"
Width: 2.21"
and align picture's right edge to Range("H1") (right border.)?
Thanks!
Simon Lloyd
03-18-2008, 10:07 AM
Funny, my macro recorder gave me this!
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 18/03/2008 by Simon
'
'
ActiveSheet.Pictures.Insert("C:\Users\Simon\Pictures\651854.jpg").Select
Selection.ShapeRange.IncrementLeft 336.75
Selection.ShapeRange.IncrementTop 4.5
Selection.ShapeRange.ScaleWidth 0.29, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.29, msoFalse, msoScaleFromTopLeft
Application.CommandBars("Picture").Visible = False
End Sub
But column H always has a different width, that's why you can't use recorder for this.
So far found a good way to insert a pic and size it
Worksheets("geninv").Shapes.AddPicture "C:\Documents and Settings\xxx\My Documents\CWI.bmp", _
False, True, 0, 2, 159, 81
How can i align it to column H?
Problem solved thanks.
Dim Xpos As Integer
Xpos = Range("A1:H1").Width - 160
Worksheets("geninv").Shapes.AddPicture "C:\Documents and Settings\xxx\My Documents\CWI.bmp", _
False, True, Xpos, 2, 159, 81
mdmackillop
03-18-2008, 11:06 AM
Worksheets("geninv").Shapes.AddPicture "C:\Documents and Settings\xxx\My Documents\CWI.bmp", _
False, True, Cells(1, "I").Left - 159, 0, 159, 81
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.