ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Setting up and Configuration of Excel (https://www.excelbanter.com/setting-up-configuration-excel/)
-   -   Position Picture with macro (https://www.excelbanter.com/setting-up-configuration-excel/57575-position-picture-macro.html)

G

Position Picture with macro
 
How do I position the picture after inserting the image through macro?

wks.Pictures.Insert ("T:\BrokerInformation\Grayson Fitch\Burn\logo_cne.gif")

Thanks!

Dave Peterson

Position Picture with macro
 
Saved from a previous post:

Option Explicit
Sub testme02()

Dim myPictureName As Variant
Dim myPict As Picture
Dim myRng As Range

myPictureName = Application.GetOpenFilename _
(filefilter:="Picture Files,*.jpg;*.bmp;*.tif;*.gif")

If myPictureName = False Then
Exit Sub 'user hit cancel
End If

With Worksheets("sheet1")
.Unprotect Password:="hi"
Set myRng = .Range("A1:e10")
Set myPict = .Pictures.Insert(myPictureName)
myPict.Top = myRng.Top
myPict.Width = myRng.Width
myPict.Height = myRng.Height
myPict.Left = myRng.Left
myPict.Placement = xlMoveAndSize
.Protect Password:="hi"
End With
End Sub

G wrote:

How do I position the picture after inserting the image through macro?

wks.Pictures.Insert ("T:\BrokerInformation\Grayson Fitch\Burn\logo_cne.gif")

Thanks!


--

Dave Peterson


All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com