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: 21
Default Resize the image in excel 2007

Dear All
I have below code it's to insert photo in the cell and adjust the size
automatically as the row and Colum width and height, it's working perfect in
excel 2003, but in excel 2007 not working as I need, now only inserting the
photo without adjust it automatically .

Can anyone help me to modify the code to work in excel 2007

=============

Sub GetPhotoone()
Dim myPict As Picture
Dim myPictName As String
Dim rng As Range

Set rng = ActiveCell
myPictName = rng
With ActiveSheet
With .Range("AA1:AA50")


If IsEmpty(ActiveCell) Then Exit Sub
On Error Resume Next
If IsEmpty(ActiveCell.Offset(-1, 0)) Then Set TopCell = ActiveCell Else
Set TopCell = ActiveCell.End(xlUp)
If IsEmpty(ActiveCell.Offset(1, 0)) Then Set BottomCell = ActiveCell
Else Set BottomCell = ActiveCell.End(xlDown)
Range(TopCell, BottomCell).Select


Set myPict = .Parent.Pictures.Insert(filename:=myPictName)

myPict.Top = rng.Top
myPict.Left = rng.Left
myPict.Width = rng.Width
myPict.Height = rng.Height
myPict.Name = "Pict_" & .Cells(1).Address(0, 0)


End With
End With
End Sub

=============

many thanks

Abdul Kader

 
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
I can't select, move or resize an image in Excel?? Michael Howes Excel Discussion (Misc queries) 3 April 2nd 23 07:40 PM
Resize image using macro Gotroots Excel Worksheet Functions 1 November 12th 09 11:04 PM
Drag/resize an image on UserForm by the user avi Excel Programming 6 March 17th 07 10:24 AM
auto resize when insert large image to excel sajid Excel Worksheet Functions 4 November 21st 06 03:40 PM
resize userform image to fit on any monitor timspier[_7_] Excel Programming 1 August 5th 06 06:44 AM


All times are GMT +1. The time now is 10:21 PM.

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"