Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put border round images in Outlook by default

Tags:

vba

outlook

Here's something which has been annoying me for months, if not years. When I paste an image into an Outlook email, it has no borders. I can add these by right-clicking on the picture and choosing Format Picture, and there's probably a tool to do this too. My question is: is there a way to ensure that all pasted images have borders? If there was a CSS style sheet for Outlook, I could do this here; or maybe there's a setting somewhere?

Thanks in advance!

like image 515
Andy Brown Avatar asked Sep 14 '12 07:09

Andy Brown


People also ask

How do I put a box around text in an email?

Click in the body of the email message itself and then click the “Insert” tab, Click “Text Box” in the Text section and then click “Draw Text Box.” Drag this text box to the edges of your email to set it as a border. Now you can type your message inside the text box and send off an email with a border.

How do you put a frame around a picture?

Instasize (Android and iOS) Once you have selected the image, use the bar at the bottom to scroll across and tap the frame icon (second from right). Select a frame theme, like oil or water, and you can then choose a specific frame within that.


2 Answers

I've got a Word 2010 macro that adds a border to images and center them:

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

I've tried adapting it to Outlook, the main thing is trying to get to Word's ActiveDocument from an Outlook item.

So here is the Outlook version (without any centering):

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

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.

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.

Vaguely inspired from http://en.allexperts.com/q/Microsoft-Word-1058/Word-resize-pictures.htm

like image 192
Thierry_S Avatar answered Oct 19 '22 01:10

Thierry_S


You could consider to provide a VBA macro (plus key short-cut to it). Not sure how this works for image borders, but for selected in email text here is a simple example:

Sub ChangeSelectedExample()
    Set insp = Application.ActiveInspector
    If insp.CurrentItem.Class = olMail Then
        Set mail = insp.CurrentItem
        If insp.EditorType = olEditorHTML Then
            txt = ActiveInspector.HTMLEditor.Selection.CreateRange.Text
                  ActiveInspector.HTMLEditor.Selection.CreateRange.Text = txt & "<hello world 1>"
        ElseIf insp.EditorType = olEditorWord Then
            txt = insp.CurrentItem.GetInspector.WordEditor.Application.Selection.Text
                  insp.CurrentItem.GetInspector.WordEditor.Application.Selection = txt & "<hello world 2>"
        Else
            MsgBox ("not supported mail format")
        End If
    Else
        MsgBox ("not supported view type")
    End If
End Sub
like image 40
thoku Avatar answered Oct 19 '22 03:10

thoku