outlook-vba

Finding the VBIDE.Reference.Name of object libraries vba

為{幸葍}努か 提交于 2019-12-24 09:48:21
问题 I've found how to add a reference programmatically with VBA, This explains how to add object references programmatically using the name of the Library, with the example "VBScript_RefExp_55". My question is how do I find this reference name to use in this code for different object libraries? Such as the PowerPoint Library for example? 回答1: I use this to get the info on my references : Private Sub ListProjectReferencesList() Dim i As Long Dim VBProj As Object 'VBIDE.VBProject Dim VBComp As

Keeping default outlook format when creating a new html e-mail

倖福魔咒の 提交于 2019-12-24 08:59:40
问题 I am trying to create a simple script to create a html message, and I would like to keep as much as possible of the default values. In my case when I create a new message using Home -> New mail it would always create a mail with default font [Calibri 11'], format text Html, and also with a signature. If I use the function Application.CreateItem(olMailItem) it creates the mail without issues. However as soon as I declare an html body with .HTMLBody it will overwrite the format: font [Times New

Copy range of cells from Excel as picture and add text in the email body

谁说胖子不能爱 提交于 2019-12-24 08:30:10
问题 I'm tying to add range of cells as a picture from the active workbook along with some text. But for some reason it skipping the text and only pasting the image in the email body. How do I fix this? Option Explicit Public Sub POSTRUN() Dim olApp As Outlook.Application Set olApp = New Outlook.Application Dim Olobj As Outlook.Application Set Olobj = CreateObject("Outlook.Application") Dim olNs As Outlook.Namespace Set olNs = olApp.GetNamespace("MAPI") Dim Inbox As Outlook.MAPIFolder Set Inbox =

Conditionally Prevent Outlook from Sending Email Based on From and Recipient Addresses

眉间皱痕 提交于 2019-12-24 07:09:27
问题 I have multiple mail accounts setup in Outlook 2007 (e.g., johndoe@domainA.com, johndoe@domainB.com, etc.). Occasionally, usually as the result of the Auto Complete feature, I will mistakenly send email from johndoe@domainA.com to a recipient that should only be receiving mail from johndoe@domainB.com). These restrictions between from (my selected mail account) and recipient (To or CC) email addresses can generally be defined by domain name. For example, johndoe@domainA.com should not send to

Use VBA to Change the Name of Specific Attachment when the Send Button it Hit

萝らか妹 提交于 2019-12-24 05:48:25
问题 Using Microsoft Outlook, I am trying to change the name of a specific attachment when the user clicks the "Send" button in a new outlook email. If an attachment with the name is found then it will change that attachment's name to the subject of the email. In the example below, I am using "form.pdf" as the target attachment. When I run the code and try to change the DisplayName it doesn't change the name of the actual attachment in the email. Any Advice? Private Sub Application_ItemSend(ByVal

How can I prevent Excel from opening a userform when opened from a macro in Outlook?

删除回忆录丶 提交于 2019-12-24 05:40:24
问题 I am trying to create a macro in outlook that opens a file in excel and runs a procedure from that file. This code does that beautifully... Dim ExApp As Excel.Application Dim ExWbk As Workbook Set ExApp = New Excel.Application Set ExWbk = ExApp.Workbooks.Open("D:\Control Verification\Controls Verification Updated.xlsm") ExApp.Visible = False ExWbk.Application.Run "Module1.Email_All" ExWbk.Close SaveChanges:=False When someone opens this workbook normally I have a userform automatically

Outlook auto forward set replyto to orginal sender rather than forwarder

空扰寡人 提交于 2019-12-24 04:40:17
问题 I have VBA code to forward email to a specific account. It works except email being forwarded has the forwarder's email address. How can I keep the original sender email address as the replyto after an email is forwarded? Sub AutoForwardAllSentItems(Item As Outlook.MailItem) Dim strMsg As String Dim autoFwd As Outlook.MailItem Set autoFwd = Item.Forward autoFwd.Recipients.Add "my_email@domain.com" autoFwd.Send Set autoFwd = Nothing End Sub 回答1: so there is no way? really? – Mike 7 hours ago

How to move mail to a folder based on attachment filename?

感情迁移 提交于 2019-12-24 02:34:15
问题 I need a rule (or most probably a VBA macro) to sort my mails. In case I have per say "REPORT" in the filename of the attachment of a newly received mail than I would like to move that mail to a different folder, let say "REPORTS" folder. How can I achieve this? I already to set a rule on the mail header but that did not seem to solve the matter. Thanks in advance! 回答1: Used code from http://www.outlookcode.com/article.aspx?id=62 and http://blog.saieva.com/2010/03/27/move-messages-to-folders

How to move mail to a folder based on attachment filename?

穿精又带淫゛_ 提交于 2019-12-24 02:34:10
问题 I need a rule (or most probably a VBA macro) to sort my mails. In case I have per say "REPORT" in the filename of the attachment of a newly received mail than I would like to move that mail to a different folder, let say "REPORTS" folder. How can I achieve this? I already to set a rule on the mail header but that did not seem to solve the matter. Thanks in advance! 回答1: Used code from http://www.outlookcode.com/article.aspx?id=62 and http://blog.saieva.com/2010/03/27/move-messages-to-folders

How do I set up an email template with dynamic dates or alternatively, create a macro to insert a date?

我的梦境 提交于 2019-12-24 01:54:26
问题 I have a template for a report I send out every week and in four separate places (three in the body, one in the subject line) is a date that corresponds to the Monday of the prior week. (Basically, it's a "week of" date for the week I'm reporting, which is always the previous week.) I want to add a date to where I have the cursor. (If I could somehow set up bookmarks in the template for where I want the date added, that would be even better.) I've done a lot of research on inserting text and