电子邮件签名在一个带有空间的单元格中的多个超链接图像?

发布于 2025-01-30 07:23:41 字数 2902 浏览 4 评论 0原文

这是我的电子邮件签名中的一个部分。我有一个表,在其中一个单元格中,我放了3个超链接图像(图标)。我需要知道如何在这些图像之间获得空间?我尝试了“ objselection.typetext chr(9)”,但是将所有空间放在两个图标之间吗?

下面是表格的简单模型,以尝试说明所需的内容。

左右<
---------------------------strong
]space
Twitter图像 [space]Facebook Image [ > LinkedIn图像
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.

LeftRight
---------
---------
----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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吻安 2025-02-06 07:23:41

由于我不太了解如何将&amp; nbsp;包裹在我的代码中,所以我尝试了不同的解决方案。我添加了此代码,以防其他代码?

Option Explicit

Dim objWord, objDoc, objShape, objSelection, objEmailOptions, objSignatureObject, objSignatureEntries, objRange, objTable

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 

Const NUMBER_OF_ROWS = 4
Const NUMBER_OF_COLUMNS = 8

'Table Design
Set objRange = objDoc.Range()
    objDoc.Tables.Add objRange, NUMBER_OF_ROWS, NUMBER_OF_COLUMNS
Set objTable = objDoc.Tables(1)

'Merging
Set objTable = objDoc.Tables(1)
    objTable.Rows(1).Cells.Merge
    objTable.Rows(2).Cells.Merge
    objTable.Cell(3, 1).Merge objTable.Cell(3, 3)
    objTable.Rows(4).Cells.Merge
'Sizing 
    objTable.Cell(1,1).width = 450
    objTable.Cell(2,1).width = 450
    objTable.Rows(3).Height = 35
    objTable.Cell(3,1).width = 350
    objTable.Cell(3,2).width = 20
    objTable.Cell(3,3).width = 20
    objTable.Cell(3,4).width = 20
    objTable.Cell(3,5).width = 20
    objTable.Cell(3,6).width = 20
'Alining
    objTable.Cell(3, 1).Range.ParagraphFormat.Alignment = 0
    objTable.Cell(3, 1).Range.Cells.VerticalAlignment = 3
    objTable.Cell(3, 2).Range.ParagraphFormat.Alignment = 2
    objTable.Cell(3, 2).Range.Cells.VerticalAlignment = 3
    objTable.Cell(3, 3).Range.ParagraphFormat.Alignment = 2
    objTable.Cell(3, 3).Range.Cells.VerticalAlignment = 3
    objTable.Cell(3, 4).Range.ParagraphFormat.Alignment = 2
    objTable.Cell(3, 4).Range.Cells.VerticalAlignment = 3
    objTable.Cell(3, 5).Range.ParagraphFormat.Alignment = 2
    objTable.Cell(3, 5).Range.Cells.VerticalAlignment = 3
    objTable.Cell(3, 6).Range.ParagraphFormat.Alignment = 2
    objTable.Cell(3, 6).Range.Cells.VerticalAlignment = 3
    objTable.Cell(4, 1).Range.ParagraphFormat.Alignment = 0
    objTable.Cell(4, 1).Range.Cells.VerticalAlignment = 3


'Socal-Media-icons

'Insta
        objTable.Cell(3, 6).select 
        set shape = objtable.Cell(3, 6).Range.InlineShapes.AddPicture("\\Server\Share\instagram.jpg")
        shape.LockAspectRatio = msoFalse
        shape.scaleHeight = 100
        shape.scaleWidth = 100
        objSelection.Hyperlinks.Add shape, "https://www.instagram.com/********/"
        
'LinkedIn
        objTable.Cell(3, 5).select 
        Set shape = objtable.Cell(3, 5).Range.InlineShapes.AddPicture("\\Server\Share\LinkedIn.jpg")
        shape.LockAspectRatio = msoFalse
        shape.scaleHeight = 100
        shape.scaleWidth = 100
        objSelection.Hyperlinks.Add shape, "https://www.linkedin.com/company/***********"

'Twitter
        objTable.Cell(3, 4).select 
        set shape = objtable.Cell(3, 4).Range.InlineShapes.AddPicture("\\Server\Share\twitter.jpg")
        shape.LockAspectRatio = msoFalse
        shape.scaleHeight = 100
        shape.scaleWidth = 100
        objSelection.Hyperlinks.Add shape, "https://twitter.com/************"

'Facebook
        objTable.Cell(3, 3).select
        set shape = objtable.Cell(3, 3).Range.InlineShapes.AddPicture("\\Server\Share\facebook.jpg")
        shape.LockAspectRatio = msoFalse
        shape.scaleHeight = 100
        shape.scaleWidth = 100
        objSelection.Hyperlinks.Add shape, "https://www.facebook.com/**********"

'Website
        objTable.Cell(3, 2).select
        set shape = objtable.Cell(3, 2).Range.InlineShapes.AddPicture("\\Server\Share\website.jpg")
        shape.LockAspectRatio = msoFalse
        shape.scaleHeight = 100
        shape.scaleWidth = 100
        objSelection.Hyperlinks.Add shape, "https://www.************.com/"


Set objSelection = objDoc.Range()

objSignatureEntries.Add "test", objSelection
objSignatureObject.NewMessageSignature = "test"

objDoc.Saved = True
objWord.Quit

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?

Option Explicit

Dim objWord, objDoc, objShape, objSelection, objEmailOptions, objSignatureObject, objSignatureEntries, objRange, objTable

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 

Const NUMBER_OF_ROWS = 4
Const NUMBER_OF_COLUMNS = 8

'Table Design
Set objRange = objDoc.Range()
    objDoc.Tables.Add objRange, NUMBER_OF_ROWS, NUMBER_OF_COLUMNS
Set objTable = objDoc.Tables(1)

'Merging
Set objTable = objDoc.Tables(1)
    objTable.Rows(1).Cells.Merge
    objTable.Rows(2).Cells.Merge
    objTable.Cell(3, 1).Merge objTable.Cell(3, 3)
    objTable.Rows(4).Cells.Merge
'Sizing 
    objTable.Cell(1,1).width = 450
    objTable.Cell(2,1).width = 450
    objTable.Rows(3).Height = 35
    objTable.Cell(3,1).width = 350
    objTable.Cell(3,2).width = 20
    objTable.Cell(3,3).width = 20
    objTable.Cell(3,4).width = 20
    objTable.Cell(3,5).width = 20
    objTable.Cell(3,6).width = 20
'Alining
    objTable.Cell(3, 1).Range.ParagraphFormat.Alignment = 0
    objTable.Cell(3, 1).Range.Cells.VerticalAlignment = 3
    objTable.Cell(3, 2).Range.ParagraphFormat.Alignment = 2
    objTable.Cell(3, 2).Range.Cells.VerticalAlignment = 3
    objTable.Cell(3, 3).Range.ParagraphFormat.Alignment = 2
    objTable.Cell(3, 3).Range.Cells.VerticalAlignment = 3
    objTable.Cell(3, 4).Range.ParagraphFormat.Alignment = 2
    objTable.Cell(3, 4).Range.Cells.VerticalAlignment = 3
    objTable.Cell(3, 5).Range.ParagraphFormat.Alignment = 2
    objTable.Cell(3, 5).Range.Cells.VerticalAlignment = 3
    objTable.Cell(3, 6).Range.ParagraphFormat.Alignment = 2
    objTable.Cell(3, 6).Range.Cells.VerticalAlignment = 3
    objTable.Cell(4, 1).Range.ParagraphFormat.Alignment = 0
    objTable.Cell(4, 1).Range.Cells.VerticalAlignment = 3


'Socal-Media-icons

'Insta
        objTable.Cell(3, 6).select 
        set shape = objtable.Cell(3, 6).Range.InlineShapes.AddPicture("\\Server\Share\instagram.jpg")
        shape.LockAspectRatio = msoFalse
        shape.scaleHeight = 100
        shape.scaleWidth = 100
        objSelection.Hyperlinks.Add shape, "https://www.instagram.com/********/"
        
'LinkedIn
        objTable.Cell(3, 5).select 
        Set shape = objtable.Cell(3, 5).Range.InlineShapes.AddPicture("\\Server\Share\LinkedIn.jpg")
        shape.LockAspectRatio = msoFalse
        shape.scaleHeight = 100
        shape.scaleWidth = 100
        objSelection.Hyperlinks.Add shape, "https://www.linkedin.com/company/***********"

'Twitter
        objTable.Cell(3, 4).select 
        set shape = objtable.Cell(3, 4).Range.InlineShapes.AddPicture("\\Server\Share\twitter.jpg")
        shape.LockAspectRatio = msoFalse
        shape.scaleHeight = 100
        shape.scaleWidth = 100
        objSelection.Hyperlinks.Add shape, "https://twitter.com/************"

'Facebook
        objTable.Cell(3, 3).select
        set shape = objtable.Cell(3, 3).Range.InlineShapes.AddPicture("\\Server\Share\facebook.jpg")
        shape.LockAspectRatio = msoFalse
        shape.scaleHeight = 100
        shape.scaleWidth = 100
        objSelection.Hyperlinks.Add shape, "https://www.facebook.com/**********"

'Website
        objTable.Cell(3, 2).select
        set shape = objtable.Cell(3, 2).Range.InlineShapes.AddPicture("\\Server\Share\website.jpg")
        shape.LockAspectRatio = msoFalse
        shape.scaleHeight = 100
        shape.scaleWidth = 100
        objSelection.Hyperlinks.Add shape, "https://www.************.com/"


Set objSelection = objDoc.Range()

objSignatureEntries.Add "test", objSelection
objSignatureObject.NewMessageSignature = "test"

objDoc.Saved = True
objWord.Quit
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文