Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've got a Word 2010 macro that adds a border to images and center them:</p> <pre><code>Sub AddBlueBorderAndCenterImages() Dim oIshp As InlineShape Dim oshp As Shape For Each oIshp In ActiveDocument.InlineShapes 'in line with text With oIshp.Borders .OutsideLineStyle = wdLineStyleSingle .OutsideLineWidth = wdLineWidth025pt .OutsideColor = RGB(0, 112, 192) End With oIshp.Select Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter Next oIshp For Each oshp In ActiveDocument.Shapes 'floating with text wraped around With oshp.Line .Style = msoLineSingle .Weight = 0.25 .ForeColor.RGB = RGB(0, 112, 192) End With Next oshp Selection.HomeKey Unit:=wdStory 'go back to top of doc End Sub </code></pre> <p>I've tried adapting it to Outlook, the main thing is trying to get to Word's ActiveDocument from an Outlook item.</p> <p>So here is the Outlook version (without any centering):</p> <pre><code>Sub AddBlueBorders() Set insp = Application.ActiveInspector If insp.CurrentItem.Class = olMail Then Set mail = insp.CurrentItem If insp.EditorType = olEditorWord Then Set wordActiveDocument = mail.GetInspector.WordEditor For Each oIshp In wordActiveDocument.InlineShapes 'in line with text With oIshp.Borders .OutsideLineStyle = wdLineStyleSingle '.OutsideLineWidth = wdLineWidth025pt ' error: one of the values passed to this method or property is out of range .OutsideColor = RGB(0, 112, 192) End With Next oIshp For Each oshp In wordActiveDocument.Shapes 'floating with text wraped around With oshp.Line .Style = msoLineSingle .Weight = 0.25 .ForeColor.RGB = RGB(0, 112, 192) End With Next oshp 'ElseIf insp.EditorType = olEditorHTML Then 'Something else here, maybe using css? End If End If End Sub </code></pre> <p>For some reason, this doesn't add a border to a company logo I have in my signature, maybe because it's in a footer or other document part.</p> <p>This is not a default and it's not automatically adding borders to images as they are pasted/added to the email. You still have to associate this macro with a button or key shortcut. But hopefully it will help, even 4 months later.</p> <p>Vaguely inspired from <a href="http://en.allexperts.com/q/Microsoft-Word-1058/Word-resize-pictures.htm" rel="noreferrer">http://en.allexperts.com/q/Microsoft-Word-1058/Word-resize-pictures.htm</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload