outlook-vba

Otlook vba and rule to forward email message and change subject

泄露秘密 提交于 2020-01-03 02:43:39
问题 I have a rule with script and almost works fine.. I would like to forward some specific incoming emails to an email address with rule but I also would like to change the subject a bit as well. I have this code which works fine: Sub ForwardEmail(Item As Outlook.MailItem) Set myForward = Item.Forward myForward.Subject = ("ITS - ") & Item.Subject myForward.Recipients.Add "backup@email.com" myForward.Send End Sub My problem is when this rule activated the forwarded emails will get my signature

Open MS Access and Fire Macro using MS Outlook

旧时模样 提交于 2020-01-03 02:21:12
问题 I did a bit of research and I think the best way to auto-fire a Macro is to use the AutoExec method in Access. I believe the script below will do the job. Option Compare Database '------------------------------------------------------------ ' AutoExec ' '------------------------------------------------------------ Function AutoExec() On Error GoTo AutoExec_Err DoCmd.RunCommand acCmdWindowHide MsgBox "Welcome to the client billing application!", vbOKOnly, "Welcome" DoCmd.OpenTable "Orders",

Saving Outlook email as PDF + Attachments

对着背影说爱祢 提交于 2020-01-02 06:35:07
问题 So I am using a macro to save incoming mail (with an inbox rule and VBA code). The problem I am having is that when there are multiple emails with the same name (and also if the attachments have the same name) they will not save. (they overwrite each other). I need both the email and the attachments to loop through 1-10 (there can be up to ten emails and attachments with the same names). Here is the code: Sub SaveAsMsg(MyMail As MailItem) ' requires reference to Microsoft Scripting Runtime '

How to launch a URL when an email arrives

天大地大妈咪最大 提交于 2020-01-01 15:31:29
问题 I would like to launch a URL when an email arrives in Outlook. I setup a rule and have it trigger a script function. It looks like I want to call ShellExecute to launch the URL in a browser, but when I hit this line: ShellExecute(0&, "open", URL, vbNullString, vbNullString, _ vbNormalFocus) The method is not defined. Any ideas? 回答1: ShellExecute is a function in a windows dll. You need to add a declaration for it like this in a VBA module: Public Declare Function ShellExecute Lib "shell32.dll

How to launch a URL when an email arrives

好久不见. 提交于 2020-01-01 15:31:28
问题 I would like to launch a URL when an email arrives in Outlook. I setup a rule and have it trigger a script function. It looks like I want to call ShellExecute to launch the URL in a browser, but when I hit this line: ShellExecute(0&, "open", URL, vbNullString, vbNullString, _ vbNormalFocus) The method is not defined. Any ideas? 回答1: ShellExecute is a function in a windows dll. You need to add a declaration for it like this in a VBA module: Public Declare Function ShellExecute Lib "shell32.dll

How to get the MailItems of a specific folder in Outlook

这一生的挚爱 提交于 2019-12-31 07:36:07
问题 My folder is called "Request Mailbox" in Outlook How can I get a list of all mailitems in that folder 回答1: For a delegate mailbox already open in Outlook, use Application.Session.Folders.("TheDelegateMialboxName@YourCompany.com").Folders("TheFolderName") 回答2: To get list of MailItems , you can simply do this MailItem list will be displayed as Email Option Explicit Sub MailItems() Dim olNamespace As Outlook.NameSpace Dim olFolder As Outlook.MAPIFolder Dim olItem As Outlook.MailItem Set

Outlook extract folders with e-mails inside them to local hard drive

余生长醉 提交于 2019-12-31 05:42:11
问题 Let's say I have a ton of folders which represent different categories of e-mails in Outlook. Each folder has at least one thousand e-mails. There's a high number of folders too. If I want to copy to the hard drive the folders with the exact names and files inside, it does not let me. I have to manually create a folder on the hard drive for each folder in Outlook and then copy all the e-mails within that folder. Any way to do this faster? Any VBA coding solution? 回答1: Use FileSystemObject to

How can I use VB code in Outlook2007 to send a series of meeting invites using sendonbehalfof as a delegate

让人想犯罪 __ 提交于 2019-12-31 03:34:17
问题 I am trying to write some VB code within Excel 2007 that will automatically send out meeting invites from the Outlook 2007 Calendar, to a list of addressees listed in the excel spreadsheet, on the dates specified within the spreadsheet. This is useful because I can send out hundreds of meeting requests to different people on different dates with one click of a button. I can do this fine when sending from my own user account with the following code: ' Create the Outlook session Set myoutlook =

Rule that runs macro when an email is opened

别等时光非礼了梦想. 提交于 2019-12-30 09:55:16
问题 I have created a macro, that does certain things, to an opened mail. I would like to create a rule, that does it automatically, when I open the mail. I don't want this rule to run all time, just when I open a mail, I don't want to force this rule on each mail I receive. 回答1: Following @ZZA comments, try this code: Public WithEvents myItem As Outlook.MailItem Private Sub Application_ItemLoad(ByVal Item As Object) If Item.Class = olMail Then Set myItem = Item End If End Sub Private Sub myItem

MS Outlook 2010 .SenderEmailAddress returns a huge string of characters

こ雲淡風輕ζ 提交于 2019-12-29 09:17:24
问题 I've searched and searched for an answer so I'll post this here. I'm trying to create a macro that will move 2 week old messages from my inbox to a specific folder I created for each of my coworkers. The macro successfully loops though all inbox message older than two weeks. However, when I use the .SenderEmailAddress it retuns a huge string of characters instead of ###@####.com. How do I just get the senders email address? Without giving the exact string (security issue), here is what I get