D
Dee Vincent-Day
I have with the help of a friend created the following macros to add borders
to an image in Word 2007.
My problem is that if you accidentally add the dashed border and then try
adding the solid border your macro command is ignored. So once the image has
a dashed border you don't seem able to change it to a solid line.
Sub DashedBorder()
'
' DashedBorder Macro
'
'
Selection.InlineShapes(1).Line.Weight = 0.25
Selection.InlineShapes(1).Line.DashStyle = msoLineLongDash
Selection.InlineShapes(1).Line.Visible = msoCTrue
Selection.InlineShapes(1).Line.ForeColor.RGB = RGB(79, 129, 189)
End Sub
Sub SolidBorder()
'
' SolidBorder Macro
'
'
Selection.InlineShapes(1).PictureFormat
Line.Weight = 0.25
Selection.InlineShapes(1).Line.Style = msoLineSolid
Selection.InlineShapes(1).Line.Visible = msoCTrue
Selection.InlineShapes(1).Line.ForeColor.RGB = RGB(79, 129, 189)
End Sub
I know I can reset the image but that will also remove any other custom
formatting such as resizing. I also tried changing the LineVisible
property to msoFalse but that seems to simply turn the line off. If you then
apply the solid line you still get a dashed line.
I would like this as a button macro because a couple of times I have
forgotten to change the line width or style. It would be so much easier to
have this combined into one button click.
If someone can suggest a way of physically removing the line altogether
without resetting all of the image formatting I would happily add that to
another button.
to an image in Word 2007.
My problem is that if you accidentally add the dashed border and then try
adding the solid border your macro command is ignored. So once the image has
a dashed border you don't seem able to change it to a solid line.
Sub DashedBorder()
'
' DashedBorder Macro
'
'
Selection.InlineShapes(1).Line.Weight = 0.25
Selection.InlineShapes(1).Line.DashStyle = msoLineLongDash
Selection.InlineShapes(1).Line.Visible = msoCTrue
Selection.InlineShapes(1).Line.ForeColor.RGB = RGB(79, 129, 189)
End Sub
Sub SolidBorder()
'
' SolidBorder Macro
'
'
Selection.InlineShapes(1).PictureFormat
Line.Weight = 0.25
Selection.InlineShapes(1).Line.Style = msoLineSolid
Selection.InlineShapes(1).Line.Visible = msoCTrue
Selection.InlineShapes(1).Line.ForeColor.RGB = RGB(79, 129, 189)
End Sub
I know I can reset the image but that will also remove any other custom
formatting such as resizing. I also tried changing the LineVisible
property to msoFalse but that seems to simply turn the line off. If you then
apply the solid line you still get a dashed line.
I would like this as a button macro because a couple of times I have
forgotten to change the line width or style. It would be so much easier to
have this combined into one button click.
If someone can suggest a way of physically removing the line altogether
without resetting all of the image formatting I would happily add that to
another button.