Chris Macro
03-13-2014, 12:02 PM
Hi I've been scratching my head on this one. I have been working on a macro that adds a custom border to every picture in a Word document. I am using Word 2013 and want to square off the borders instead of have them round. I believe I need to use msoLineJoinMiter but am not sure how to write the code. Below is what I have so far and I have commented out where I am trying to square off the edges as it appears that Microsoft defaults borders to have rounded edges. Here's a link to the on this (sorry, looks like I don't have enough post cred to use hyperlinks.....):
msdn.microsoft.com/en-us/library/office/microsoft.office.core.msolinejoinstyle.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
Any help would be much appreciated!!!
Dim myPic As InlineShapeDim MyAnswer As Integer
'Loop Through All Pictures (aka Inline Shapes) in Document
For Each myPic In ActiveDocument.InlineShapes
'Select Image so user can see what image we are talking about
myPic.Select
'Ask and receive verification from user via Messagebox
MyAnswer = MsgBox("Do you wish to add border to selected image?", vbYesNo, "Add Border")
'See if User wants to add border
If MyAnswer = vbYes Then
AddBorder = Dialog
'Border Thickness
myPic.Line.Weight = 6
'Border Line Style
myPic.Line.Style = msoLineSingle
'Square Edges = MsoLineJoinStyle 'Bevel, Mixed, Round, Miter
'Border Color
myPic.Line.ForeColor.RGB = RGB(45, 44, 42)
End If
Next myPic
msdn.microsoft.com/en-us/library/office/microsoft.office.core.msolinejoinstyle.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
Any help would be much appreciated!!!
Dim myPic As InlineShapeDim MyAnswer As Integer
'Loop Through All Pictures (aka Inline Shapes) in Document
For Each myPic In ActiveDocument.InlineShapes
'Select Image so user can see what image we are talking about
myPic.Select
'Ask and receive verification from user via Messagebox
MyAnswer = MsgBox("Do you wish to add border to selected image?", vbYesNo, "Add Border")
'See if User wants to add border
If MyAnswer = vbYes Then
AddBorder = Dialog
'Border Thickness
myPic.Line.Weight = 6
'Border Line Style
myPic.Line.Style = msoLineSingle
'Square Edges = MsoLineJoinStyle 'Bevel, Mixed, Round, Miter
'Border Color
myPic.Line.ForeColor.RGB = RGB(45, 44, 42)
End If
Next myPic