电子邮件签名在一个带有空间的单元格中的多个超链接图像?
这是我的电子邮件签名中的一个部分。我有一个表,在其中一个单元格中,我放了3个超链接图像(图标)。我需要知道如何在这些图像之间获得空间?我尝试了“ objselection.typetext chr(9)”,但是将所有空间放在两个图标之间吗?
下面是表格的简单模型,以尝试说明所需的内容。
左右 | < |
---|---|
--------------------------- | strong |
] | space |
Twitter图像 [space] |
Const NUMBER_OF_ROWS = 6
Const NUMBER_OF_COLUMNS = 6
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objShape = objDoc.Shapes
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
Set objRange = objDoc.Range()
objDoc.Tables.Add objRange, NUMBER_OF_ROWS, NUMBER_OF_COLUMNS
Set objTable = objDoc.Tables(1)
'Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.
objdoc.Paragraphs.SpaceAfter = 0
'objSelection.ParagraphFormat.LineSpacing = 10
objTable.Rows(1).Cells.Merge
objTable.Rows(2).Cells.Merge
objTable.Cell(3, 1).Merge objTable.Cell(3, 3)
objTable.Cell(3, 2).Merge objTable.Cell(3, 4)
objTable.Rows(4).Cells.Merge
objTable.Rows(6).Cells.Merge
'Socal-Media-icons
objTable.Cell(3, 2).select
objTable.Cell(3, 2).Range.ParagraphFormat.Alignment = 1
objTable.Cell(3, 2).Range.Cells.VerticalAlignment = 3
'LinkedIn
set shape2 = objtable.Cell(3, 2).Range.InlineShapes.AddPicture("\\Server\Share\SignatureScriptLinks\New footer design\LinkedIn.jpg")
shape2.LockAspectRatio = msoFalse
shape2.scaleHeight = 100
shape2.scaleWidth = 100
objSelection.Hyperlinks.Add shape2, "https://www.****.com\LinkedIn"
'Facebook
set shape3 = objtable.Cell(3, 2).Range.InlineShapes.AddPicture("\\Server\Share\SignatureScriptLinks\New footer design\facebook.jpg")
shape3.LockAspectRatio = msoFalse
shape3.scaleHeight = 100
shape3.scaleWidth = 100
objSelection.Hyperlinks.Add shape3, "https://www.****.com\facebook"
'Twitter
set shape4 = objtable.Cell(3, 2).Range.InlineShapes.AddPicture("\\Server\Share\SignatureScriptLinks\New footer design\twitter.jpg")
shape4.LockAspectRatio = msoFalse
shape4.scaleHeight = 100
shape4.scaleWidth = 100
objSelection.Hyperlinks.Add shape4,
"https://www.****.com\facebook"
Set objSelection = objDoc.Range()
objSignatureEntries.Add "Full Signature", objSelection
objSignatureObject.NewMessageSignature = "Full Signature"
objDoc.Saved = True
objWord.Quit
This is for a section in my email signature. I have a table and in one of the cells I have put 3 hyperlink images (icons). I need to know how to get spaces between these images? I have tried "objSelection.TypeText Chr(9)" but it puts all the spaces together between two of the icons?
Below is a simple mockup of the table to try to illustrate what is needed.
Left | Right |
---|---|
---- | ----- |
---- | ----- |
---- | Twitter Image [SPACE] Facebook Image [SPACE] LinkedIn Image |
Const NUMBER_OF_ROWS = 6
Const NUMBER_OF_COLUMNS = 6
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objShape = objDoc.Shapes
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
Set objRange = objDoc.Range()
objDoc.Tables.Add objRange, NUMBER_OF_ROWS, NUMBER_OF_COLUMNS
Set objTable = objDoc.Tables(1)
'Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.
objdoc.Paragraphs.SpaceAfter = 0
'objSelection.ParagraphFormat.LineSpacing = 10
objTable.Rows(1).Cells.Merge
objTable.Rows(2).Cells.Merge
objTable.Cell(3, 1).Merge objTable.Cell(3, 3)
objTable.Cell(3, 2).Merge objTable.Cell(3, 4)
objTable.Rows(4).Cells.Merge
objTable.Rows(6).Cells.Merge
'Socal-Media-icons
objTable.Cell(3, 2).select
objTable.Cell(3, 2).Range.ParagraphFormat.Alignment = 1
objTable.Cell(3, 2).Range.Cells.VerticalAlignment = 3
'LinkedIn
set shape2 = objtable.Cell(3, 2).Range.InlineShapes.AddPicture("\\Server\Share\SignatureScriptLinks\New footer design\LinkedIn.jpg")
shape2.LockAspectRatio = msoFalse
shape2.scaleHeight = 100
shape2.scaleWidth = 100
objSelection.Hyperlinks.Add shape2, "https://www.****.com\LinkedIn"
'Facebook
set shape3 = objtable.Cell(3, 2).Range.InlineShapes.AddPicture("\\Server\Share\SignatureScriptLinks\New footer design\facebook.jpg")
shape3.LockAspectRatio = msoFalse
shape3.scaleHeight = 100
shape3.scaleWidth = 100
objSelection.Hyperlinks.Add shape3, "https://www.****.com\facebook"
'Twitter
set shape4 = objtable.Cell(3, 2).Range.InlineShapes.AddPicture("\\Server\Share\SignatureScriptLinks\New footer design\twitter.jpg")
shape4.LockAspectRatio = msoFalse
shape4.scaleHeight = 100
shape4.scaleWidth = 100
objSelection.Hyperlinks.Add shape4,
"https://www.****.com\facebook"
Set objSelection = objDoc.Range()
objSignatureEntries.Add "Full Signature", objSelection
objSignatureObject.NewMessageSignature = "Full Signature"
objDoc.Saved = True
objWord.Quit
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于我不太了解如何将
&amp; nbsp;
包裹在我的代码中,所以我尝试了不同的解决方案。我添加了此代码,以防其他代码?As I don't really understand how to put a
wrapped into my code, I have tried a different tack. I have added this code in case it helps other?