PDA

View Full Version : Insert Picture In Chart Fill Area / Plot Area / Format Area



nomad
04-30-2012, 05:03 PM
I am trying to use macro to set the chart fill with specified picture. The pictures are processed and located in the same excel sheet.
Is there anyway to do this?
Beginner on Macro. Thanks very much.:)


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

swinnersmusic
05-01-2012, 05:04 PM
I am trying to use macro to set the chart fill with specified picture. The pictures are processed and located in the same excel sheet.
Is there anyway to do this?
Beginner on Macro. Thanks very much.:)


Hello:
I got this code below when I recorded a macro while filling the chart area with a userpic of Paris Hotel
The chart was embedded in the sheet.
Its basically performing a Format Chart Area......fill. (note that this different to plot area) The picture will go behind the plot area. ie around the edge of the plot area

here is the code:
Hope this helps
Alan Swinburne



Sub Macro1()
'
' Macro1 Macro
'
ActiveSheet.ChartObjects("Chart 1").Activate
With ActiveSheet.Shapes("Chart 1").Fill
.Visible = msoTrue
.PresetTextured msoTexturePapyrus
.TextureTile = msoTrue
.TextureOffsetX = 0
.TextureOffsetY = 0
.TextureHorizontalScale = 1
.TextureVerticalScale = 1
.TextureAlignment = msoTextureTopLeft
End With
With ActiveSheet.Shapes("Chart 1").Fill
.Visible = msoTrue
.UserPicture "C:\Users\Alans\Pictures\paris hotel.jpg"
.TextureTile = msoFalse
End With
End Sub

Admin
05-01-2012, 05:52 PM
Hi swinnersmusic,

Welcome to ExcelFox !!

Please use code tags while posting codes :)

Excel Fox
05-01-2012, 10:36 PM
And nomad, can you check if swinnersmusic's has helped?

nomad
05-03-2012, 10:28 AM
Hi,Swinnersmusic, it does help, many many thanks:D. Sorry for the late reply, because I cannot access to the website yesterday, and I got the message from my email.