vba - 如何在帐户设置中获取“组织” - Outlook 365 VBA 代码中的更多设置?
问题描述
我正在编写 VBA 代码以使用标准格式创建我们公司的标准电子邮件。
- 转到帐户设置,将您的姓名设置为发件人姓名。
- 继续在Organization中设置发件人的电话号码。
- 在 VBA 代码中,我可以通过Account.currentuser属性获取“您的姓名”
但我在谷歌搜索,找不到如何获取Organization
.
另一种方式,我可以将发件人的姓名和电话保存在通讯录中,然后按当前帐户搜索。
但如果有人知道如何获得组织,我不需要在通讯录中创建这些。
任何人都知道解决方案
Sub Cj_CreateMail()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim SigString As String
Dim Signature As String
Dim strHtmlBody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<H4><B>Dear Customer,</B></H4>" & _
"<br>" & _
"<br>" & _
"<br><br><B>Regards,</B> <br>" & _
"<br>" & _
"" & _
"Address:******************* <br>" & _
"" & _
"<A HREF=""http://www.*********.com"">www.*******.com</A> <br>" & _
"<p class=MsoNormal style='margin-top:3.0pt;margin-right:-.7pt;margin-bottom:"
'***********************************
' Current Account's Name ( Easy )
' Current Account's Organization (Need Help)
'**********************************
' promotion banner picture from web link
strHtmlBody = "<html>" & _
"<A HREF='http://********.jpg'></A>" & _
"<IMG SRC='http://********.jpg'height=170 width=576>" & _
"</html>"
Debug.Print strHtmlBody
strbody = strbody + strHtmlBody
On Error Resume Next
With OutMail
.To = "xxx@aaa.com"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = strbody
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub