VBA code to apply style to objects

Claymationator

Well-known Member
Joined
Sep 26, 2006
Messages
705
I need a quick code in VBA that I can use to put the following styles on an image that is found in my workbook....any ideas?

1. Black border
2. White fill color
3. Shadow - offset diagonal bottom right

Any help is appreciated.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi Claymationator,

Select your image, then run this macro:

Code:
Sub SetPictureFormat()
   With Selection.ShapeRange
      .Fill.Visible = msoTrue
      .Fill.ForeColor.SchemeColor = 9
      .Line.Visible = msoTrue
      .Line.Weight = 2.25
      .Shadow.Type = msoShadow14
      .Shadow.IncrementOffsetX 3#
      .Shadow.IncrementOffsetY 3#
      .Shadow.Transparency = 0.5
   End With
End Sub

You will probably want to adjust some of the parameters to get the exact look (line width, etc.) you want.

Keep Excelling.

Damon
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,148
Members
448,552
Latest member
WORKINGWITHNOLEADER

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