outlook-vba

Outlook Auto printing multiple attachments

旧巷老猫 提交于 2019-12-25 00:59:08
问题 For some reason this is only printing the first attachment in the e-mail. It doesn't seem like my for loop is working. Any clue? Basically it saves a backup of the attachments, prints the e-mail, prints the .pdf attachment, and then categorizes it as "printed". I need it do it for every .pdf on the e-mail. Not just the first one that is attached. Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias _ "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal

programmatically open search view

给你一囗甜甜゛ 提交于 2019-12-25 00:35:52
问题 I am looking for a way to open a search view in outlook for a specified criteria programmatically. I saw other questions such as VBA Search in Outlook, but they are about retrieving search results programmatically. I am essentially looking for the same functionality as the Ribbon option Message/Editing/Related: When I open a message by double-clicking on a message and then click on "Messages in this Conversation" The list view changes to I would like to be able to do the same thing using a

Save Outlook appointment created from a template to non default calendar

馋奶兔 提交于 2019-12-24 20:01:08
问题 I open a Outlook Meeting template and want to associate the appointment created to a non default calendar in Outlook. The attached code saves to the default calendar. Sub Whatever() Dim olApp As Object Set olApp = GetObject(, "Outlook.Application") Dim oApt As Outlook.AppointmentItem Dim myTemplate As Object Dim ns As Outlook.Namespace Dim nsOther As Outlook.Recipient Dim oFolder As Outlook.Folder Dim template As String template = "C:\Users\Some User\Meeting.oft" Set myTemplate = olApp

VB, Outlook Macro: How to put variable, (fields), in an email template

给你一囗甜甜゛ 提交于 2019-12-24 19:28:08
问题 I have a simple macro that reads Strings from a .csv file. I want to place (Replace) those Strings into the body of an email. The email will be opened from a template, so I want the fields in the template, and then have my macro start a new email from the template and replace the fields with the String variables. I'm not finding anything posted that shows how to format such a field in the body of the email. A link to a reference would be helpful. The rest of the story: The email template body

How to open an existing Excel file?

 ̄綄美尐妖づ 提交于 2019-12-24 18:29:57
问题 I am copying a table from Outlook to Excel. The code I have found online copies the table in a new Excel file. I want to copy the table into an existing Excel file. Here is the code I am running in Outlook. Sub dd() Dim item As MailItem, x% Dim r As Object 'As Word.Range Dim doc As Object 'As Word.Document Dim xlApp As Object, wkb As Object Set xlApp = CreateObject("Excel.Application") Set wkb = xlApp.Workbooks.Add xlApp.Visible = True Dim wks As Object Set wks = wkb.Sheets(1) For Each item

Download and Save Attachment from Email Automatically to Excel

眉间皱痕 提交于 2019-12-24 16:07:08
问题 Currently my code listed below will copy body information from an incoming email and open the designated excel sheet and copy the contents onto the excel sheet and close it. I would also like to save attachments from incoming email to this designated path :C:\Users\ltorres\Desktop\Projects I have tried this, but this code will not incorporate with outlook. I would have to run it with excel Public Sub saveAttachtoDisk (itm As Outlook.MailItem) Dim objAtt As Outlook.Attachment Dim saveFolder As

Set .SentOnBehalfofName on every email sent

空扰寡人 提交于 2019-12-24 15:59:41
问题 I am trying to set the .SentOnBehalfOfName on every email I send through Outlook 2016. That is, whenever I hit New Mail, Reply, Reply All, or Forward. I tried this: Public WithEvents myItem As Outlook.MailItem Private Sub Application_ItemLoad(ByVal Item As Object) If (TypeOf Item Is MailItem) Then Set myItem = Item End If End Sub Private Sub FromField() With myItem .SentOnBehalfOfName = "example@aol.com" .Display End With End Sub Private Sub myItem_Open(Cancel As Boolean) FromField End Sub

Insert Hyperlink in Outlook body

北慕城南 提交于 2019-12-24 13:05:00
问题 So I am trying to create a code to expedite inserting a hyperlink in Outlook. I am trying to have it so that if I have already copied a path, I can just go in and type Ctrl W and it will insert the hyperlink for the word here. My attempt at the code is: Sub InsertHyperlink() ' ' ' On Error Resume Next ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _ "U:\plot.log", _ SubAddress:="", ScreenTip:="", TextToDisplay:="here" End Sub I am having issues on how to update my code so

Shared Inbox - Skipping non-mail items in Outlook VBA

不想你离开。 提交于 2019-12-24 12:26:41
问题 I am not an expert in Outlook VBA but I have managed to create a few macros that work quite well. I have worked on the below code for some time and am now left with a minor problem. The macro imports information on every email from a sub-folder of a shared inbox into an excel file. The problem I have is when the for next loop encounters a non-mail item (e.g. a meeting invite or delivery failure notification). The code stops on the "Next" line and gives a "type mismatch" error when it

Select Email Template from a Userform drop down menu - object is required

不羁的心 提交于 2019-12-24 11:06:44
问题 I'm trying to create an Outlook Userform, where via a drop down menu an operator can select an email template. Using this example, this is the code for the Outlook form which works fine. Private Sub UserForm_Initialize() With ComboBox1 .AddItem "Test" .AddItem "Template 2" .AddItem "Template 3" .AddItem "Template 7" .AddItem "Template 5" .AddItem "Template 6" End With End Sub Private Sub btnOK_Click() lstNum = ComboBox1.ListIndex Unload Me End Sub This is the code I've started to put together