Hi,
I noticed that Word 2010 does not record the actions to add a picture style and border weight to selected pictures. I was wondering if anyone can assist me in creating a macro that does two things:
Assuming the picture is already selected...
1. Assigns the picture style called: Simple frame black
2. Assigns a picture border with a line weight of 1pt to the picture
Thats it. It's weird that this does not get recorded, but any assistance will be greatly appreciated. TX.
Macro to format a picture
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Macro to format a picture
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78492
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Macro to format a picture
Both. Most are wrapped around text and some are inline. However, the picture will always be selected before i run the macro.
TX
TX
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78492
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Macro to format a picture
Try this:
It should work with both inline shapes and floating shapes.
Code: Select all
Sub FormatPicture()
Dim p As Object
If Selection.InlineShapes.Count = 1 Then
Set p = Selection.InlineShapes(1)
ElseIf Selection.ShapeRange.Count = 1 Then
Set p = Selection.ShapeRange(1)
Else
MsgBox "Please select a single shape or inline shape.", vbExclamation
Exit Sub
End If
With p.Shadow
.Blur = 4
.OffsetX = 3
.OffsetY = 3
.Size = 100
.Style = msoShadowStyleOuterShadow
.Transparency = 0.57
.Visible = True
End With
With p.Line
.Weight = 1
.ForeColor = vbBlack
End With
End Sub
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Macro to format a picture
Awesome. Hans....Thank you for the time and effort. I really do appreciate it.
Big Cheers!!!!
Big Cheers!!!!
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.