10

这是困扰我数月甚至数年的事情。当我将图像粘贴到 Outlook 电子邮件中时,它没有边框。我可以通过右键单击图片并选择Format Picture来添加这些,并且可能也有一个工具可以做到这一点。我的问题是:有没有办法确保所有粘贴的图像都有边框?如果 Outlook 有 CSS 样式表,我可以在这里做;或者也许在某个地方有一个设置?

提前致谢!

4

2 回答 2

7

我有一个 Word 2010 宏,它为图像添加边框并将它们居中:

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

我已经尝试将其调整为 Outlook,主要是尝试从 Outlook 项目获取 Word 的 ActiveDocument。

所以这里是 Outlook 版本(没有任何居中):

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

出于某种原因,这不会为我签名中的公司徽标添加边框,可能是因为它位于页脚或其他文档部分。

这不是默认设置,也不会在将图像粘贴/添加到电子邮件时自动为图像添加边框。您仍然必须将此宏与按钮或快捷键相关联。但希望它会有所帮助,即使是 4 个月后。

灵感来自http://en.allexperts.com/q/Microsoft-Word-1058/Word-resize-pictures.htm

于 2013-02-14T14:24:53.633 回答
1

您可以考虑提供一个 VBA 宏(加上它的快捷键)。不确定这对图像边框是如何工作的,但对于在电子邮件文本中选择的,这是一个简单的示例:

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
于 2012-09-23T14:37:09.783 回答