outlook-vba

I need to code for the correct 'Reference' to MS Outlook from Excel

回眸只為那壹抹淺笑 提交于 2019-12-18 05:13:06
问题 I want to run some code in Excel , that talks to Outlook . On my machine, I can just select the right reference from Tools->References in the VBE. But I want my code to run for other users on their machines too and they will all have different versions of Outlook and Excel, Is there a tidy way I can make the code select the right reference to MS Outlook, or tell me if Outlook isn't installed, etc? Thanks 回答1: I use a function like this which should work for Outlook 2010. If you're using a

For Each loop: How to adjust code to move files in one run rather than multiple

你。 提交于 2019-12-17 21:22:59
问题 I am using the below code to archive emails that have been marked completed. It is supposed to check all emails in our shared folder for anything marked complete prior to today's date. It works, but I must run the code multiple times to archive all of the affected quoted. Does anyone have any ideas how to get this to work in one shot? Public Const CEpath As String = "\\s-estimating\CentralEstimating\" Option Explicit Public Const sArchivePath As String = Miscellaneous.CEpath + "Archives\"

Change HTML email body font type and size in VBA

走远了吗. 提交于 2019-12-17 18:56:28
问题 I have a VBA script that that generates and email when a VBA button is pushed in a given worksheet. The script currently generates the email in a relatively small font. I was wondering if there is a way to set the font to Calibri, and the text sive to exactly 11. Here is the current VBA script: Private Sub CommandButton1_Click() Dim OutApp As Object Dim OutMail As Object Dim strbody As String Dim strUser As String Dim signature As String Dim sTo As String Dim sCC As String 'For To field Set

I cannot see my VBA macro in 'run a script' selection box

跟風遠走 提交于 2019-12-17 18:20:00
问题 I copied the following code in my oulook VBE, from one of the VBA communities and amended it as per my need. I can run it using F5 and F8. Now I would like to run this macro whenever I receive an email in folder1. I tried setting up a rule but I cannot see the macro listed in the 'run a script' selection box. I have already checked that macro security setting are correct macro is in a module not in a class can you please tell me what is going wrong in the setting. Public Sub SaveAttachments()

Add a “CC recipient” to Outlook 2010 VBA

蓝咒 提交于 2019-12-17 16:59:27
问题 Can someone please show me how to add a "Cc recipient" to this code? The "To Recipient" and code all work as intended. Thank you for your time. Sub ForwardEmail(item As Outlook.MailItem) ' Dim oExplorer As Outlook.Explorer Dim oMail As MailItem ' Set oExplorer = Application.ActiveExplorer On Error GoTo Release ' If oExplorer.Selection.item(1).Class = olMail Then Set oMail = item.Forward oMail.Subject = oMail.Subject oMail.HTMLBody = "Have a nice day." & vbCrLf & oMail.HTMLBody oMail

When is a MailItem not a MailItem? [closed]

为君一笑 提交于 2019-12-17 16:44:35
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I have written a message handler function in Outlook's Visual Basic (we're using Outlook 2003 and Exchange Server) to help me sort out incoming email. It is working for me, except sometimes the rule fails and Outlook deactivates it. Then I turn the rule back on and manually run it on my Inbox to catch up. The rule

How to get the email address of the current logged-in user?

梦想的初衷 提交于 2019-12-17 16:39:18
问题 I'm new to VBA and trying to get an automated word document working. At the moment there is a Button in the document that which upon pressing, will fire off an email with the document attached. However I need to also get the email address of the current user sending the email, so I can place it inside the document before sending it off. My searches on the internet have not resulted in any usable code that meets my situation. My current code is below. Set OL = CreateObject("Outlook.Application

Sending mail using Outlook where the Send method fails

扶醉桌前 提交于 2019-12-17 16:12:53
问题 I use this code to send email from Excel: Sub Mail_workbook_Outlook_1() 'Working in Excel 2000-2013 'This example send the last saved version of the Activeworkbook 'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .to = "ron@debruin.nl" .CC = "" .BCC = "" .Subject = "This is the Subject line" .Body = "Hi there"

Outlook Reply or ReplyAll to an Email

筅森魡賤 提交于 2019-12-17 06:14:48
问题 Set objOutlook = CreateObject("Outlook.Application") Set objMail = objOutlook.CreateItem(0) objMail.To = "example@email.com" objMail.cc = "example2@email.com" objMail.Subject = "Mail test" objMail.HTMLBody = "This is my message" unload me objMail.Display Set objMail = Nothing Set objOutlook = Nothing I am trying to add in another function that help to reply a selected email but can't figure out how I can mix this with Item As Outlook.MailItem I understand that replying an email will require

Formatting appointment body

自作多情 提交于 2019-12-14 03:13:35
问题 I am trying to schedule a meeting automatically from Excel. It is simple, unless you are trying to format the body text. I made some research about GetInspector. It looks like I have to copy the text from another place, but the commands I found are incorrect or not functional. Even trying to format it as RTF, but .RTFBody is not a property of the AppointmentItem object Find my code: Dim oApp As Object Dim oMail As Object Set oApp = CreateObject("Outlook.Application") Set oMail = oApp