outlook-vba

How to apply the action to several Outlook items selected?

这一生的挚爱 提交于 2019-12-13 02:33:25
问题 The code here works for one item only. How to modify that to run DisplayItemMetadata (see the code) for each item selected? Upd. tried to do the following: For Each individualItem In Application.ActiveExplorer.Selection With objButton .BeginGroup = True .Caption = "My &item" .FaceId = 1000 .Tag = "DisplayItemMetadata" If Not IsNull(Selection.Item(1)) Then On Error GoTo 0 ' Just in case the item selected ' doesn't have a valid EntryID. ' .Parameter = Selection.Item(1).EntryID .Parameter =

Inserting text with formatting in invitation body

旧城冷巷雨未停 提交于 2019-12-13 02:27:08
问题 I am trying to automate Outlook invites. The code is working until I arrive to the body. I need something more elaborate than just plaintext. I can't find the .HTMLBody property/the compiler doesn't recognize it: Run-time Error '438'. Is there any other way of inserting text with format in my invite body? The code works when using .body: Sub Invite_Merge(meeting_date As Date, meeting_time As Double, meeting_duration As Integer, client_email As String, meeting_subject As String, meeting

Outlook VBA for marking a new mail as a task before sending

◇◆丶佛笑我妖孽 提交于 2019-12-13 02:23:55
问题 I have tried this: Sub SendAwaitingResponse() Dim mail As MailItem Set mail = Outlook.Application.ActiveInspector.CurrentItem mail.MarkAsTask (olMarkToday) mail.Categories = "Awaiting Response" mail.Send End Sub with the following error: Draft Items cannot be marked. MarkAsTask is only valid on items that have been sent or received. It is possible to click "Follow up" in the UI, and then the mail will be marked as task after sent. I see no way to do it programmatically. 回答1: You would need to

Find Text in an email and delete all text after this in Outlook 2010

早过忘川 提交于 2019-12-13 02:09:59
问题 I am trying to find text in an email and delete all text after this point. I have managed to get a working macro in Word 2010 however I have been unable to replicate something similar in Outlook. There will always be a certain text heading "Text" and then some text after this which does differ for each email. The macro I have been using for word: This was taken from Find a string in a document and delete everything after it Sub DeleteText() Set myRange = Application.ActiveInspector

How to initialize an event handler

筅森魡賤 提交于 2019-12-13 01:36:26
问题 I found this code online. It is supposed to auto populate my subject line with any attachments I provide. The code does not run. I don't receive an error or anything that suggests its even going through the code. Public WithEvents olInspectors As Outlook.Inspectors Public WithEvents olMail As Outlook.MailItem Private Sub Initialize_handlers() Set olInspectors = Application.Inspectors End Sub Private Sub olInspectors_NewInspector(ByVal Inspector As Inspector) Dim olItem As Object Set olItem =

Count Read and Unread Emails date wise for shared mailbox

点点圈 提交于 2019-12-13 01:33:35
问题 I have edited VBA which I found in Stack Overflow to suit my needs. It gives me the count of emails of my default inbox date wise and count of unread emails without dates. I need it to count the emails of my shared mailbox. For example Redstreamattmail and not the default mailbox, DATE WISE for overall emails and unread emails. Sub HowManyEmails() Dim objOutlook As Object, objnSpace As Object, objFolder As MAPIFolder Dim EmailCount As Integer Dim a As Outlook.Application Dim b As Outlook

Copy a specific format table from outlook to email

梦想的初衷 提交于 2019-12-13 01:20:42
问题 I need to copy many tables from outlook to Excel at work. I know how to use .getElementsByTagName("table") to do it. However, my company merges and split some of the table cells. Could someone have a look on it please? This is the table I have in my outlook: This is how I would like to copy it on my Excel: This is the result: VBA code: Option Explicit Public fso As New FileSystemObject Public objApp As Outlook.Application Public oItem As Outlook.MailItem Sub importOutlookTable() Set oItem =

Excel VBA - How to run the same macro at the same time on all the sheets - generating one email

女生的网名这么多〃 提交于 2019-12-13 00:19:27
问题 I continue my work starting from the 1st question here: Excel VBA - Outlook Email - Body created with rows having a particular value Now i have another problem. I want to repeat the below MACROs on all the SHEETS of my file. In particular, how can I repeat this function on different SHEETS by only clicking in 1 button present in all the sheets? All the sheets have the same structure. I mean, the table resulting in the email must be implemented by adding the datas in all the sheets. The data

Import Emails from specific folder in Outlook

喜夏-厌秋 提交于 2019-12-12 20:00:02
问题 I'm currently using the following code in Excel to access folders in an unmanned Outlook mailbox other than my own. However is there a way I can set the folder in the code rather than using the folder picker. Sub Launch_Pad() Dim olApp As Outlook.Application Dim olNS As Outlook.Namespace Dim olFolder As Outlook.MAPIFolder Set olApp = Outlook.Application Set olNS = olApp.GetNamespace("MAPI") Set olFolder = olNS.PickFolder n = 2 Cells.ClearContents Call ProcessFolder(olFolder) Set olNS =

Get list of all rooms in outlook

亡梦爱人 提交于 2019-12-12 18:16:13
问题 I'm writing some application where I need to get an all available rooms within my organization. (the same list we get while we opening "Add Rooms" dialog in outlook) I assume that while we doing it through outlook he works against some exchange server, the question is is there a way to use outlook as a"proxy" between me to the exchange server? I have no knowledge with exchange, and a little knowledge with outlook's interop... Thanks in advance for any help. 回答1: I don't know if this will work