![](/img/trans.png)
[英]Outlook VBA - Select Sender Account when "New Email" is created
[英]How to change my email account sender “From” in outlook on vba
我的 Outlook 中有 2 個郵箱帳戶,因此在發送電子郵件時如何更改電子郵件帳戶
"From"
我需要從我的電子郵件地址“anas3643@hotmail.com”發送
Sub Test_for_using()
'MVP OShon from VBATools.pl
Dim oMail As MailItem
On Error GoTo blad
Select Case TypeName(Application.ActiveWindow)
Case "Explorer": Set oMail = ActiveExplorer.Selection.Item(2)
Case "Inspector": Set oMail = ActiveInspector.CurrentItem
Case Else: Exit Sub
End Select
Call odpowiedz_do_nadawcy(oMail)
blad:
End Sub
Sub odpowiedz_do_nadawcy(Item As Outlook.MailItem)
Dim oReply As MailItem
With Item
Set oReply = .Forward
Dim MyValue As Integer
Dim x As String
Dim emailNames(19) As String
emailNames(1) = "anas.alwasel11@gmail.com"
emailNames(2) = "anas3643@hotmail.com"
emailNames(3) = "anas.alwasel11@gmail.com"
emailNames(4) = "anas3643@hotmail.com"
emailNames(5) = "anas.alwasel11@gmail.com"
emailNames(6) = "anas3643@hotmail.com"
emailNames(7) = "anas.alwasel11@gmail.com"
emailNames(8) = "anas3643@hotmail.com"
emailNames(9) = "anas.alwasel11@gmail.com"
emailNames(10) = "anas3643@hotmail.com"
emailNames(11) = "anas.alwasel11@gmail.com"
emailNames(12) = "anas3643@hotmail.com"
emailNames(13) = "anas.alwasel11@gmail.com"
emailNames(14) = "anas3643@hotmail.com"
emailNames(15) = "anas.alwasel11@gmail.com"
emailNames(16) = "anas3643@hotmail.com"
emailNames(19) = "anas3643@hotmail.com"
MyValue = CInt(Int((19 * rnd()) + 1)) ' Generate random value between 1 and 6.
x = emailNames(MyValue)
oReply.Forward
oReply.Recipients.Add (x)
oReply.Send
Set oReply = Item
End With
End Sub
MailItem.SendUsingAccount屬性
返回或設置一個
Account
對象,該對象表示要在其下發送MailItem
的帳戶。 (讀/寫。)語法:
expression
.
SendUsingAccount
- expression :返回
MailItem
對象的表達式。備注:
SendUsingAccount
屬性可用於指定在調用Send
方法時應用於發送MailItem
的帳戶。 如果為MailItem
指定的帳戶不再存在,則此屬性返回Null
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.