outlook-vba

VBA Code to select Sender and Signature

生来就可爱ヽ(ⅴ<●) 提交于 2020-04-30 04:44:05
问题 In Excel I'm using code like this to begin an e-mail message through Outlook: Set mOutlookApp = GetObject("", "Outlook.application") Set OutMail = mOutlookApp.CreateItem(0) With OutMail .To = "blahblah@blah.com" .Subject = "More BLAH here" .HTMLBody = "Message Text" & .HTMLBody ' This preserves the Signature in the message. .Display End With Normally, when I send a (manual) e-mail, I can choose to send it from an address other than my normal one (by pressing the "From" button). Also, I can

Outlook - Pass variable to be displayed in temporary Popup

假装没事ソ 提交于 2020-03-27 07:12:25
问题 In Outlook I have setup the following code to temporarily display a message. However I cannot work out how to pass a variable ( aMessageLabel ) containing the text to be displayed. Sub Test() Dim aShell Set aShell = CreateObject("WScript.Shell") aMessageLabel = Chr(34) & "No Emails to be Forwarded!" & Chr(34) aShell.Run "mshta.exe vbscript:close(CreateObject(""WScript.shell"").Popup(aMessageLabel,5,""Message""))" End Sub 回答1: this works Sub Test() ' this is the resulting windows command (you

Outlook - Pass variable to be displayed in temporary Popup

China☆狼群 提交于 2020-03-27 07:12:05
问题 In Outlook I have setup the following code to temporarily display a message. However I cannot work out how to pass a variable ( aMessageLabel ) containing the text to be displayed. Sub Test() Dim aShell Set aShell = CreateObject("WScript.Shell") aMessageLabel = Chr(34) & "No Emails to be Forwarded!" & Chr(34) aShell.Run "mshta.exe vbscript:close(CreateObject(""WScript.shell"").Popup(aMessageLabel,5,""Message""))" End Sub 回答1: this works Sub Test() ' this is the resulting windows command (you

VBA in Outlook: removing from body of incoming e-mail a string that includes CRLF characters

放肆的年华 提交于 2020-03-05 04:15:50
问题 I am trying to develop a VBA procedure for MS Outlook (2016) that removes from selected incoming e-mail a certain (annoying) string. The string is pretty simple: it is two sentences in German language. So this is theoretically easy to spot and remove. I use the Replace() function for this. This principally works. (See my full procedure below.) However, I am having problems as the two sentences (the string) are sometimes separated by CRLF (Carriage Return, Line Feed) characters, and these are

SenderEmailAddress property does not contain a standard email address for internal contacts

十年热恋 提交于 2020-02-27 07:43:19
问题 Background: Using an Outlook Rule to trigger a script, I want all of my email from certain high-visibility clients to open immediately upon receipt. I have successfully set up a rule that triggers when those clients send me email. It looks something like this: And I have successfully created a script that opens a reply to the email, depending on who sent it. It looks something like this: Sub OpenEmailImmediately(oEmail As Outlook.MailItem) Select Case oEmail.Sender Case "Jobs, Steve" oEmail

SenderEmailAddress property does not contain a standard email address for internal contacts

梦想的初衷 提交于 2020-02-27 07:41:00
问题 Background: Using an Outlook Rule to trigger a script, I want all of my email from certain high-visibility clients to open immediately upon receipt. I have successfully set up a rule that triggers when those clients send me email. It looks something like this: And I have successfully created a script that opens a reply to the email, depending on who sent it. It looks something like this: Sub OpenEmailImmediately(oEmail As Outlook.MailItem) Select Case oEmail.Sender Case "Jobs, Steve" oEmail

Embedding Image in Outlook with VBA

假如想象 提交于 2020-02-25 04:10:25
问题 The below code isn't working. It embeds the photo but doesn't display because "The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location." I know the file path is correct since I've tripled check. A fresh set of eyes could help. Sub mail() Dim Sig As String Set myOlApp = CreateObject("Outlook.Application") LR400 = Columns(1).Find("*", SearchDirection:=xlPrevious).Row sPath = Environ("appdata") & "\Microsoft\Signatures\Amir Higgs.txt" For x

Embedding Image in Outlook with VBA

北城余情 提交于 2020-02-25 04:09:32
问题 The below code isn't working. It embeds the photo but doesn't display because "The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location." I know the file path is correct since I've tripled check. A fresh set of eyes could help. Sub mail() Dim Sig As String Set myOlApp = CreateObject("Outlook.Application") LR400 = Columns(1).Find("*", SearchDirection:=xlPrevious).Row sPath = Environ("appdata") & "\Microsoft\Signatures\Amir Higgs.txt" For x

How to choose which Outlook Account a Mailitem is sent from - reliably using SendUsingAccount

不打扰是莪最后的温柔 提交于 2020-02-15 11:44:09
问题 Let's say you have several accounts attached to your Outlook client and want to be able to choose which one to send a mail from using VBA. What do you do? The MailItem.SendUsingAccount parameter looks the right way to do this and is recommended elsewhere like here or here or here. However, if you apply the example in the Developer Reference, setting the SendUsingAccount property to valid Accounts may be impossible. Why? This appears to be the answer : You must Dim your MailItem as an Object

How to choose which Outlook Account a Mailitem is sent from - reliably using SendUsingAccount

纵然是瞬间 提交于 2020-02-15 11:40:50
问题 Let's say you have several accounts attached to your Outlook client and want to be able to choose which one to send a mail from using VBA. What do you do? The MailItem.SendUsingAccount parameter looks the right way to do this and is recommended elsewhere like here or here or here. However, if you apply the example in the Developer Reference, setting the SendUsingAccount property to valid Accounts may be impossible. Why? This appears to be the answer : You must Dim your MailItem as an Object