outlook-vba

Sender, SenderEmailAddress Missing in Folder.Items

风流意气都作罢 提交于 2019-12-11 06:36:50
问题 I want to download attachments from Outlook emails. Here is the code I am using to retrieve emails. Set OutlookApp = New Outlook.Application Set OutlookNamespace = OutlookApp.GetNamespace("MAPI") Set Folder = OutlookNamespace.GetDefaultFolder(olFolderInbox).Folders(botMailFolder) i = 1 For Each OutlookMail In Folder.Items If InStr(OutlookMail.Subject, " ") <> 0 Then If OutlookMail.Attachments.Count > 0 Then Dim folderBase As String folderBase = botLocalFolder Dim newFolder As String newFolder

Trigger Outlook Event: Change Signature

谁说胖子不能爱 提交于 2019-12-11 06:15:21
问题 Does anyone know if it possible to trigger a signature change event in Outlook 2016? I.e. Simulate clicking a signature as per the screenshot below: I am trying to change the signature automatically based on which 'From' address has been selected. I can capture the 'From' address change (as answered here). However I cannot find a way to programmatically change the signature. My research has gotten as far as concluding that the CommandBar object is deprecated in Office 2016 and that I need to

Runtime error when attempting to delete a worksheet from a newly created workbook - Outlook VBA

老子叫甜甜 提交于 2019-12-11 06:14:45
问题 I have an Outlook macro which works to export the users Tasklist to an Excel spreadsheet stored on a network drive. I am attempting to check if there is a workbook already present in the directory (If statement taken form here). If there isn't one, then make a new workbook with one worksheet called "Sheet 1", and if there is already one with the correct username, then open it (add statement taken from here): Dim FilePath As String Dim TestStr As String Dim objExcel As New Excel.Application

Capture time mail was sent

▼魔方 西西 提交于 2019-12-11 05:46:17
问题 I am new to the Outlook Object Library. I have an Excel workbook that contains a list of email templates and attachments. I have an insert button for each list item to separately combine each email (required as per procedure). I have written the code to combine them and display an email: Public Sub SendToThisPerson() Application.DisplayAlerts = False Application.ScreenUpdating = False Dim r, c As Integer Dim b As Object Set b = ActiveSheet.Buttons(Application.Caller) With b.TopLeftCell r =

Why does this regular expression test give different results for what should be the same body text?

笑着哭i 提交于 2019-12-11 05:24:17
问题 Here's the pertinent code, which is giving different results on the regular expression test for the message body depending on whether I launch it using TestLaunchURL or the message is passed to it by Outlook when an incoming message arrives: Public Sub OpenLinksMessage(olMail As Outlook.MailItem) Dim Reg1 As RegExp Dim AllMatches As MatchCollection Dim M As Match Dim strURL As String Dim RetCode As Long Set Reg1 = New RegExp With Reg1 .Pattern = "(https?[:]//([0-9a-z=\?:/\.&-^!#$;_])*)"

Reply (by .Send) e-mail Outlook “Run Script” rule not triggering VBA script for incoming messages

别说谁变了你拦得住时间么 提交于 2019-12-11 05:15:39
问题 (Since I'm from Brazil, there is some text in Portuguese, so if you need some help, just let me know). I've got 2 macros in my Outlook "This Outlook Session" in 1 master macro that calls the others 2 that I mentioned before. The master macro do: Macro name: "Salvar_CNAB_Registro" Discovers the subject of the e-mail and give the path I want depending what it's writing. After discover the path, save all the attachments from e-mail on the path discovered. Sub Salvar_CNAB_Registro(Email As

Iterating through multiple Selection / Folder items

久未见 提交于 2019-12-11 05:07:27
问题 I took at a look at MailItem and didn't see anything that would indicate that I could shift select items. I have code that functions however, the Set objItem = GetCurrentItem() line only takes one mail. I'm looking to either ForEach through a folder, or ForEach through a selection. I tried something like Sub ListMailsInFolder() Dim objNS As Outlook.NameSpace Dim objFolder As Outlook.MAPIFolder Set objNS = GetNamespace("MAPI") Set objFolder = objNS.Folders.GetFirst ' folders of your current

Outlook VBA convert Rich Text to HTML format

百般思念 提交于 2019-12-11 04:57:41
问题 I have limited space in my exchange server, so I want to convert all selected messages in my Outlook 2007 inbox to HTML format as they are smaller than their Rich Text format equivalents when images are involved. I have the following code which kind of does the job, but the formatting goes all over the place and the images become undreadable attachments, and the size doesn't change. Public Sub ConvertHTML() Dim selItems As Selection Dim myItem As Object ' Set reference to the Selection. Set

Excel VBA add Email body as text from a word document

不想你离开。 提交于 2019-12-11 04:29:44
问题 How do I send Emails to various people attaching individualized documents and setting parts of the Email body as text from a word document (Individualized Addressing, then the Body from Word and then my signature). Right now everything works except of the body for the Emails. I'd really appreciate your help. Sub Send_Files() Dim OutApp As Object Dim OutMail As Object Dim sh As Worksheet Dim cell As Range Dim FileCell As Range Dim rng As Range Dim html, name, address, age, department Dim Word

Automated moving of attached messages to the inbox in Outlook

◇◆丶佛笑我妖孽 提交于 2019-12-11 04:28:13
问题 I regularly receive forwarded emails that come as Outlook formatted .msg files. These emails were forwarded as attachments from another exchange server. If I drag the attached messages to my Inbox, they show up just like any other email. I would like to find an automated way to extract these attached emails to my inbox and delete the original messaged that contained the .msg file. I’m sure this can be accomplished through a rule in conjunction with an Outlook VBA, but I lack the skill to