Code for Picture Tiling Options

F-150 Phill

New Member
Joined
May 19, 2011
Messages
17
Hi all,

I've been doing tons of searching and haven't found any answers to this question.:banghead: I'm looking for code to edit the tiling options for the fill picture of a shape. I have been able to add the image to the shape using the following code:


Sub AddImage()

MyPic = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp; *.tif", , "Select Picture to Import")

ActiveSheet.Shapes("Shape 1").Fill.UserPicture MyPic

End Sub


Now i need to edit the picture fill properties where the "Tile Picture as texture" checkbox is checked. I need to set the Offset (X&Y) and Scale (X&Y) using values that are on the excel sheet. All the properties in the red box:

PictureFill.jpg


I could guess all day and never get the right code to make it work. :confused: Help anybody?

Thanks in advance!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
These are the appropriate methods. You can assign them via Cell References relatively easily from this, but if you have problems, let me know what your ranges are and I can edit.

Code:
Sub AddImage()
MyPic = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp; *.tif", , "Select Picture to Import")
With ActiveSheet.Shapes("Shape 1").Fill
    .UserPicture MyPic
    .TextureOffsetY = 0
    .TextureOffsetX = 0
    .TextureHorizontalScale = 0.276
    .TextureVerticalScale = 0.276
 
End With
End Sub
 
Last edited:
Upvote 0
That worked PERFECT!! :biggrin: I input = Range("...").Value for the cell references and it worked exactly as I wanted it to!

Thank you VERY MUCH for your help and fast reply!!:bow:
 
Upvote 0
That worked PERFECT!! :biggrin: I input = Range("...").Value for the cell references and it worked exactly as I wanted it to!

Thank you VERY MUCH for your help and fast reply!!:bow:

Glad to help. Thanks for letting me know it worked out.
 
Upvote 0

Forum statistics

Threads
1,223,250
Messages
6,171,036
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top