fill data series with a stacked and scaled image

Fairfied

New Member
Joined
Oct 28, 2013
Messages
1
I’ve created a stacked bar graph. Now using visual basic I'm trying to format the data series for each of the series, and fill it with a stacked and scaled image. The images are pictures of numbers from 0 – 9. Here’s a snippet of the code I’m struggling with:</SPAN>

With ActiveChart.SeriesCollection(2)</SPAN>
ActiveSheet.Shapes("0").Copy ‘This copies a textbox named “0” which is on the worksheet. The textbox has a 0 written inside it.</SPAN>
.Paste ‘This makes all of SeriesCollection(2) use the image from the textbox as fill. This part works well.</SPAN>

PictureFormat = xlStackScale 'I’m trying to tell excel to then stack the image, not stretch it, which is what it’s doing by default.
'This bit is not working, having no effect. It’s not returning an error however.</SPAN>
PictureStackUnit = 1 'Trying to tell it to do one picture for each duplicated value. This doesn’t seem to be having any
'effect. Not returning an error.</SPAN>
.Fill.Visible = True 'Don’t seem to need this. Changing it to false does make the series invisible though.</SPAN>
End With</SPAN>
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try something like this...

Code:
[COLOR=darkblue]With[/COLOR] ActiveChart.SeriesCollection(2)
ActiveSheet.Shapes("0").Copy [COLOR=green]'This copies a textbox named "0" which is on the worksheet. The textbox has a 0 written inside it.[/COLOR]
.Paste [COLOR=green]'This makes all of SeriesCollection(2) use the image from the textbox as fill. This part works well.[/COLOR]

[COLOR=green]'stack the image, not stretch it[/COLOR][COLOR=green]. One picture for each duplicated value.[/COLOR]
[B].Fill.UserPicture PictureFormat:=xlStackScale, PictureStackUnit:=1, PicturePlacement:=xlAllFaces[/B]

.Fill.Visible = [COLOR=darkblue]True[/COLOR] [COLOR=green]'Don’t seem to need this. Changing it to false does make the series invisible though.[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]With[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,216,110
Messages
6,128,894
Members
449,477
Latest member
panjongshing

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