[英]How to change my email account sender “From” in outlook on vba
I have 2 email box account in my outlook so How can I change email account when I'm sending Email我的 Outlook 中有 2 个邮箱帐户,因此在发送电子邮件时如何更改电子邮件帐户
"From"
Enter image description here在此处输入图片说明
I need to send from my email address "anas3643@hotmail.com"我需要从我的电子邮件地址“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 Property
MailItem.SendUsingAccount属性
Returns or sets an
Account
object that represents the account under which theMailItem
is to be sent.返回或设置一个
Account
对象,该对象表示要在其下发送MailItem
的帐户。 (Read/write.)(读/写。)
Syntax :
语法:
expression
.
expression
.
SendUsingAccount
- expression : An expression that returns a
MailItem
object.expression :返回
MailItem
对象的表达式。Remarks :
备注:
The
SendUsingAccount
property can be used to specify the account that should be used to send theMailItem
when theSend
method is called.SendUsingAccount
属性可用于指定在调用Send
方法时应用于发送MailItem
的帐户。 This property returnsNull
if the account specified for theMailItem
no longer exists.如果为
MailItem
指定的帐户不再存在,则此属性返回Null
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.