这几年来一直困扰着我的事情,如果不是几年的话.将图像粘贴到Outlook电子邮件中时,它没有边框.我可以通过右键单击图片并选择格式图片来添加这些,并且可能还有一个工具可以执行此操作.我的问题是:有没有办法确保所有粘贴的图像都有边框?如果有一个Outlook的CSS样式表,我可以在这里做到这一点; 或者某个地方有设置?
提前致谢!
我有一个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
Run Code Online (Sandbox Code Playgroud)
我已经尝试将其改编为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
Run Code Online (Sandbox Code Playgroud)
出于某种原因,这不会为我签名中的公司徽标添加边框,可能是因为它位于页脚或其他文档部分.
这不是默认设置,并且在将图像粘贴/添加到电子邮件时不会自动为图像添加边框.您仍然必须将此宏与按钮或快捷键相关联.但希望它会有所帮助,即使是4个月之后.
来自http://en.allexperts.com/q/Microsoft-Word-1058/Word-resize-pictures.htm的模糊启发
您可以考虑提供一个 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
Run Code Online (Sandbox Code Playgroud)