outlook-vba

How to choose which Outlook Account a Mailitem is sent from - reliably using SendUsingAccount

℡╲_俬逩灬. 提交于 2020-02-15 11:40:50
问题 Let's say you have several accounts attached to your Outlook client and want to be able to choose which one to send a mail from using VBA. What do you do? The MailItem.SendUsingAccount parameter looks the right way to do this and is recommended elsewhere like here or here or here. However, if you apply the example in the Developer Reference, setting the SendUsingAccount property to valid Accounts may be impossible. Why? This appears to be the answer : You must Dim your MailItem as an Object

Outlook 2016 - “Run-time error '287': Application-defined or object-defined error” while using CurrentItem.Saveas or CurrentItem.HTMLBody

风格不统一 提交于 2020-02-06 06:33:07
问题 We have an Access Database running for quite a few years under "Office 2010" but now we have to change to Office 365 and are getting this annoying error with the code below: Dim olAppSaida As Outlook.Application Dim olItemSaida As Outlook.MailItem Set olAppSaida = CreateObject("Outlook.application") Set olItemSaida = olAppSaida.ActiveInspector.CurrentItem If Not TypeName(olItemSaida) = "Nothing" Then olItemSaida.SaveAs "C\TEstes\" & strProcesso & ".Msg", olMSGUnicode End If The reference to

Cant send email using VBA

拟墨画扇 提交于 2020-02-06 03:45:24
问题 I am creating a tool that will automatically dispatch emails out. I have started to build it using very simple code as below: Set outlookobj = New Outlook.Application Set mitem = outlookobj.CreateItem(olMailItem) With mitem .To = "A_Valid_Email@email.com" .Subject = "TEST" .Body = "test" .Display .Send End With End Sub However the company I work for seem to have locked down .send. The email will create fine but will not send. Can anyone think of a way around this? I have considered using

How to assign a retention tag to a mail item in Outlook VBA?

江枫思渺然 提交于 2020-02-05 13:17:27
问题 I'm trying to write a macro which will be going through a folder in Outlook assigning a retention tag (docs) to some items based on some complicated criteria. I don't know how to do this in VBA. So far I've learned that mail items have some retention related properties ( PidTagPolicyTag (docs), etc.), but I still don't know how to deal with them properly. What would be some examples of using with these? 回答1: Take a look at existing message with those properties set using OutlookSpy (click

How to assign a retention tag to a mail item in Outlook VBA?

泪湿孤枕 提交于 2020-02-05 13:17:11
问题 I'm trying to write a macro which will be going through a folder in Outlook assigning a retention tag (docs) to some items based on some complicated criteria. I don't know how to do this in VBA. So far I've learned that mail items have some retention related properties ( PidTagPolicyTag (docs), etc.), but I still don't know how to deal with them properly. What would be some examples of using with these? 回答1: Take a look at existing message with those properties set using OutlookSpy (click

How to assign a retention tag to a mail item in Outlook VBA?

笑着哭i 提交于 2020-02-05 13:16:19
问题 I'm trying to write a macro which will be going through a folder in Outlook assigning a retention tag (docs) to some items based on some complicated criteria. I don't know how to do this in VBA. So far I've learned that mail items have some retention related properties ( PidTagPolicyTag (docs), etc.), but I still don't know how to deal with them properly. What would be some examples of using with these? 回答1: Take a look at existing message with those properties set using OutlookSpy (click

How can I move Mails Items from Outlook Inbox with specific subject to specific folder/sub folder?

旧街凉风 提交于 2020-02-05 04:35:08
问题 My mails in Outlook has all specific subjects. I have a Excel Sheet which has subject and Folder Name. I have already this code from Stackoverflow Option Explicit Public Sub Move_Items() '// Declare your Variables Dim Inbox As Outlook.MAPIFolder Dim SubFolder As Outlook.MAPIFolder Dim olNs As Outlook.NameSpace Dim Item As Object Dim lngCount As Long Dim Items As Outlook.Items On Error GoTo MsgErr '// Set Inbox Reference Set olNs = Application.GetNamespace("MAPI") Set Inbox = olNs

How can I move Mails Items from Outlook Inbox with specific subject to specific folder/sub folder?

喜你入骨 提交于 2020-02-05 04:35:04
问题 My mails in Outlook has all specific subjects. I have a Excel Sheet which has subject and Folder Name. I have already this code from Stackoverflow Option Explicit Public Sub Move_Items() '// Declare your Variables Dim Inbox As Outlook.MAPIFolder Dim SubFolder As Outlook.MAPIFolder Dim olNs As Outlook.NameSpace Dim Item As Object Dim lngCount As Long Dim Items As Outlook.Items On Error GoTo MsgErr '// Set Inbox Reference Set olNs = Application.GetNamespace("MAPI") Set Inbox = olNs

Trying to move emails in a loop, but not all get moved in the first run

╄→尐↘猪︶ㄣ 提交于 2020-01-30 11:39:31
问题 The VBA code does not move all emails with a certain words in the Subject "has been updated" and "Item" from the inbox to the subfolder "Neu". Emails should be already read. After 5-6 iterations , all emails will be moved. But why doesn't it work immediately after the first time of code running? Maybe you have faced the same problem? Out of 46 emails, 26 of them are moved firstly, then 39, then 44 and then 46. Thank you very much in advance! Sub Emails_Outlook_Transport() Dim olApp As Outlook

Trying to move emails in a loop, but not all get moved in the first run

☆樱花仙子☆ 提交于 2020-01-30 11:39:06
问题 The VBA code does not move all emails with a certain words in the Subject "has been updated" and "Item" from the inbox to the subfolder "Neu". Emails should be already read. After 5-6 iterations , all emails will be moved. But why doesn't it work immediately after the first time of code running? Maybe you have faced the same problem? Out of 46 emails, 26 of them are moved firstly, then 39, then 44 and then 46. Thank you very much in advance! Sub Emails_Outlook_Transport() Dim olApp As Outlook