Access picture stretch options via VBA

Schadenfreud

New Member
Joined
Jan 22, 2014
Messages
29
M9msGkw.png

How can I set these 4 properties to 25% via VBA? I could only find the offset commands for a Texture (not a picture)?
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
0vym58c.png


I'm basically trying to achieve this BubbleChart look, right now I'm almost there, the one thing I can't do is offset the images so they don't fill the whole bubble. Please help.

Code:
Sub Recolor()


Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim rngSizes As Range
Dim rngColors As Range
Dim lngIndex As Long
Dim shp As Shape


Set ws1 = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")
Set shp1 = ws2.Shapes("Low")
Set shp2 = ws2.Shapes("Medium")
Set shp3 = ws2.Shapes("High")
' range containing marker size
Set rngSizes = ws1.Range("D2:D8")
Set rngColors = ws1.Range("E2:E8")


With ws1.ChartObjects(1).Chart
    For lngIndex = 1 To .SeriesCollection.Count
        With .SeriesCollection(lngIndex)
        Select Case rngColors(lngIndex)
            Case 1 To 9: 'Low case
                shp1.Copy
                .Points(1).Paste
                With .Format.Line
                     .Visible = msoTrue
                     .Weight = 0.5
                End With
                With .Format.Fill 'no idea how to make the offsets
                     .OffsetLeft = 25
                     .OffsetRight = 25
                     .OffsetTop = 25
                     .OffsetBottom = 25
                End With
                With .Format.Glow
                     .Radius = 8
                     .Transparency = 0.599999994
                     .Color = RGB(0, 255, 0)
                End With
            Case 10 To 19: 'Medium case
                shp2.Copy
                .Points(1).Paste
                With .Format.Line
                     .Visible = msoTrue
                     .Weight = 0.5
                End With
                With .Format.Fill 'no idea how to make the offsets
                     .OffsetLeft = 25
                     .OffsetRight = 25
                     .OffsetTop = 25
                     .OffsetBottom = 25
                End With
                With .Format.Glow
                     .Radius = 8
                     .Transparency = 0.599999994
                     .Color = RGB(255, 255, 0)
                End With
            Case Else: 'High case
                shp3.Copy
                .Points(1).Paste
                With .Format.Line
                     .Visible = msoTrue
                     .Weight = 0.5
                End With
                With .Format.Fill 'no idea how to make the offsets
                     .OffsetLeft = 25
                     .OffsetRight = 25
                     .OffsetTop = 25
                     .OffsetBottom = 25
                End With
                With .Format.Glow
                     .Radius = 8
                     .Transparency = 0.599999994
                     .Color = RGB(255, 0, 0)
                End With
        End Select
        End With
    Next
End With


End Sub
 
Upvote 0

Forum statistics

Threads
1,222,835
Messages
6,168,544
Members
452,197
Latest member
Rik100

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