Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-05-2008, 07:33 PM
Emily Emily is offline
Novice
 
Join Date: Dec 2008
Location: Hong Kong
Posts: 7
Emily is on a distinguished road
Default

Code:
 
Sub TestInsertPictureInCell()
InsertPictureInRange "D:\Happy1.jpg", Range("A1")
End Sub


Sub InsertPictureInRange(PictureFileName As String, TargetCells As Range)
Dim p As Object

If Dir(PictureFileName) = "" Then Exit Sub

Set p = ActiveSheet.Pictures.Insert(PictureFileName)

With TargetCells
    p.Top = .Top
    p.Left = .Left
    .ColumnWidth = .ColumnWidth / .Width * p.Width
    .RowHeight = p.Height  ' < 409 pixels
End With

Set p = Nothing
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing a Captioned Picture ComcoDG Word 0 11-10-2008 04:40 PM
Drop down box in a cell Grapejuice Excel 0 10-22-2007 07:40 PM
highlight cell after checkbox flatk Word 0 01-25-2007 12:32 PM
click a cell to go to a worksheet victor Excel 0 10-27-2006 02:57 PM
Picture Button in Outlook Contact Form Ahmad Dorji Outlook 0 02-17-2006 05:06 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft