[英]Creating an Outlook Signature file using VBA/Excel
Started VBA yesterday. 昨天开始VBA。
I want to create an Outlook Signature file where the signature has HTML formatting. 我想创建一个签名具有HTML格式的Outlook签名文件。 I've succeeded in creating signatures, and transposing the desired information.
我已经成功创建了签名,并转置了所需的信息。 I haven't been able to apply the desired format.
我无法应用所需的格式。
The final signature must have an image and a text division (kinda like a div, that has two divs inside and each use 50% width). 最终签名必须具有图像和文本分割(有点像div,其内部有两个div,每个使用50%的宽度)。
Sub Gerar_Assinatura()
Rem INICIO SCRIPT VBS
On Error Resume Next
Rem VARIAVEIS PARA GUARDAR AS INFORMACOES
Dim strNome As Range
Dim strFuncao As Range
Dim strOrgao As Range
Rem Dim strCompany As Range
Dim strAddress As Range
Dim strAddress2 As Range
Dim strpostalCode As Range
Dim strPhone As Range
Dim strExtensao As Range
Dim strCell As Range
Dim strMail As Range
colorBlack = RGB(0, 0, 0)
pickFont = "Calibri"
pickSize = 11
Set strNome = Range("O10")
Set strFuncao = Range("O11")
Set strOrgao = Range("O12")
strCompany = "SNIPSNIP"
Set strAddress = Range("O14")
Set strAddress2 = Range("O15")
Set strpostalCode = Range("O16")
Set strPhone = Range("O18")
Set strExtensao = Range("O19")
Set strCell = Range("O20")
Set strMail = Range("O21")
Rem OBJECTO
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
With objSelection
.TypeText "*html stuff and values SNIP*"
End With
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
Rem Cria o assinatura no Outlook
Set objSelection = objDoc.Range()
objSignatureEntries.Add "Snippy Snappy", objSelection
objSignatureObject.NewMessageSignature = "Assinatura geral automatica"
objSignatureObject.ReplyMessageSignature = "Assinatura geral automatica"
objDoc.Saved = True
objWord.Quit
Rem FIM SCRIPT VBS
End Sub
This code works for text, images and font formatting, but I need the HTML to organize things properly. 该代码适用于文本,图像和字体格式,但是我需要HTML才能正确组织事物。
Edit: I don't want to add or change the signature of the email being sent. 编辑:我不想添加或更改正在发送的电子邮件的签名。 I want to change/add the file where the signature is stored, which will be used as needed/intended.
我想更改/添加存储签名的文件,该文件将根据需要/预期使用。
Edit2: It's VBA, not VBS Edit2:这是VBA,而不是VBS
Edit3: Desired outcome - https://drive.google.com/open?id=1QMtm4Z4FnyOB6RUH6EnRywgL-XTzewpI Edit3:所需结果-https://drive.google.com/open?id = 1QMtm4Z4FnyOB6RUH6EnRywgL-XTzewpI
If you're using Exchange Server or Office 365, it might be easier to have the signature get applied on the server-side because that way it's applied to all emails from mobile and web, not just Outlook. 如果您使用的是Exchange Server或Office 365,则将签名应用于服务器端可能会更容易,因为这样可以将签名应用于移动设备和Web上的所有电子邮件,而不仅仅是Outlook。 You can use Exclaimer Cloud Signatures for Office 365
您可以将Exclaimer Cloud签名用于Office 365
Or Signature Manager for Exchange Server 或Exchange Server的签名管理器
I use them for myself and my clients - works a charm, set and forget! 我将它们用于我自己和我的客户-富有魅力,让人忘却了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.