outlook-vba

Search for Outlook Email based on Sender, Subject, and Today's Date

≯℡__Kan透↙ 提交于 2019-12-11 00:11:42
问题 I am supposed to receive an email with the subject "Testing Protocol" from "BobSmith@company.com" every day. Is there a way to search my Outlook Inbox to determine if an email has come through with that subject and that sender for the current day? Id like a simple "Yes" or "No" to be placed in cell A1 of "Control" if it has or has not been received today. Below is what I have tried to come up with on my own using previous questions with no luck. Any help is greatly appreciated. EmailSubject =

Saving and closing office programs (word, excel, access, outlook) with VBS for backups

断了今生、忘了曾经 提交于 2019-12-10 23:46:22
问题 After spending a fair amount of time looking around, I'm coming up a little stumped, as this is (I'm sure) a pretty common problem. I run nightly backups of all our office machines, but Outlooks PST files often prevents this form successful completion. I found the solution to this for outlook, but other MS Office apps tend to block backups from successful completion as well. I've figured out how to save and close Outlook, Word, and Excel. Access I have a solution for, but would like to close

Format specific text in Outlook

送分小仙女□ 提交于 2019-12-10 22:14:25
问题 I need to format the specific String value which was acquired from Excel in Outlook. Once the value is provided by Excel, macro will then append that value in the email message. I tried testing and setting the value to BOLD but all of the contents of the message became BOLD. How do I format the value in such a way I can use the font type, size and color to my liking? obj.HTMLBody = "<b>" & StrAgnt & vbCrLf & obj.HTMLBody 回答1: See Working with Outlook HTMLBody Option Explicit Sub

Outlook - insert text based on recipient

大城市里の小女人 提交于 2019-12-10 21:21:42
问题 I need to automatically insert text into an outgoing email depending on the recipient. I found some code in an answer to another question (credit to 76Mel) that looks promising. It seems that I could attach the code to ItemSend in ThisOutlookSession Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) If Item.MessageClass = "IPM.Note" Then For Each myRecipient In Item.Recipients If myRecipient.Address = "<EMAIL ADDRESS TO FIND>" Then <code to add text> End If Next End If

Excel Create an Outlook calendar event [closed]

笑着哭i 提交于 2019-12-10 19:02:21
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . Can you run a macro from Excel that can interact with Outlook and create and event on the calendar? 回答1: This will allow you to add an appointment to a shared Calendar in any folder as long as you have the rights to write in it. Treat Calendar as a Folder Const olFolderInbox = 6

Accessing another maibox in outlook using vba

一世执手 提交于 2019-12-10 18:46:28
问题 I have two mailboxes in my Outlook. One that is mine and it automatically logs me in when I log in to my pc and another I have that is for mail bounces. I really need to access the inbox of the mail's account but I just can't seem to do it. And there is no way I can make the mailbox of the mail account to be my default mailbox Here is the code I have so far: Public Sub GetMails() Dim ns As NameSpace Dim myRecipient As Outlook.Recipient Dim aFolder As Outlook.Folders Set ns = GetNamespace(

Function always returns False. Why?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 15:58:38
问题 I have a VBA script per mail item for ThisOutlookSession and ignoring the irrelevant parts of the code to my current problem, I am calling the following function: Function WriteBatFile(inVar As String) As Boolean On Error GoTo err_handle: Dim sFile As String sFile = "C:\Users\ME\Desktop\myScript.bat" Dim fso As Object Set fso = CreateObject("Scripting.FileSystemObject") Dim oFile As Object Set oFile = fso.CreateTextFile(sFile) oFile.WriteLine "sleep 2" oFile.WriteLine "./myScript.sh " & inVar

Macro in Outlook to delete duplicate emails-

别说谁变了你拦得住时间么 提交于 2019-12-10 12:05:15
问题 Public Sub RemDups() Dim t As Items, _ i As Integer, _ arr As Collection, _ f As Folder, _ parent As Folder, _ target As Folder, _ miLast As MailItem, _ mi As MailItem Set parent = Application.GetNamespace("MAPI").PickFolder Set target = Application.GetNamespace("MAPI").PickFolder For Each f In parent.Folders Set t = f.Items t.Sort "[Subject]" i = 1 Set miLast = t(i) Set arr = New Collection While i < t.Count i = i + 1 If TypeName(t(i)) = "MailItem" Then Set mi = t(i) If miLast.Subject = mi

Automatically Unpack Attached Messages

怎甘沉沦 提交于 2019-12-10 11:49:59
问题 I have a secondary exchange account where a server rule is active that forwards every mail it receives to my primary account (on another server). To avoid pointless forwarding headers and to preserve the From and To fields, I forward mails as an attachment and I have three issues with this code and am a bit stuck, so I'm posting it here to hopefully get some input: I'd like to run attachment validation so only actual message types are unpacked to the Inbox. I've found the .Type property but

Create a right-click context menu in Outlook 2003

大憨熊 提交于 2019-12-10 11:46:54
问题 I'm already able to create a new menu in the top menubar of Outlook 2003 but would like to do the same when the user right-click on an email (but not anywhere else in the interface if possible). Here is what I got: Sub AddMenus() Dim cbMainMenuBar As CommandBar Dim cbcCustomMenu As CommandBarControl Dim cbcTest As CommandBarControl Dim iHelpMenu as Integer Set cbMainMenuBar = Application.ActiveExplorer.CommandBars.ActiveMenuBar iHelpMenu = cbMainMenuBar.Controls("&?").index Set cbcCustomMenu