background preloader

VBA Outlook

Facebook Twitter

Saving/Deleting All Attachments With One Click | TechnicLee. Option Explicit Sub DeleteAllAttachments() Dim olkMsg As Object, intIdx As Integer, strBuffer As String For Each olkMsg In Application.ActiveExplorer.Selection For intIdx = olkMsg.Attachments.Count To 1 Step -1 If Not IsHiddenAttachment(olkMsg.Attachments.Item(intIdx)) Then strBuffer = strBuffer & olkMsg.Attachments.Item(intIdx).Filename & vbCrLf olkMsg.Attachments.Item(intIdx).Delete End If Next Select Case olkMsg.BodyFormat Case olFormatHTML strBuffer = Left(strBuffer, Len(strBuffer) - 1) strBuffer = Replace(strBuffer, vbCrLf, "<br>") olkMsg.HTMLBody = olkMsg.HTMLBody & "<p>Removed Attachments & <br><br>" & strBuffer & "</p>" Case Else olkMsg.Body = olkMsg.Body & vbCrLf & vbCrLf & "Remove Attachments" & vbCrLf & vbCrLf & strBuffer End Select olkMsg.Close olSave Set olkMsg = Nothing End Sub Sub SaveAllAttachments() '--> Define some constants Const msoFileDialogFolderPicker = 4 '--> Define some variables Dim olkMsg As Object, _ olkPos As Outlook.PostItem, _ intIdx As Integer, _ excApp As Object, _ strBuf As String.

Saving/Deleting All Attachments With One Click | TechnicLee. Outlook Forms 16 - Update Existing Forms. Issue:You want to modify existing Outlook forms to use an updated or different form. Quick/Visual/Learning:At times I have had a need to update old Outlook forms to a newer one. I once had a helpdesk form that got changed along the way. The updated form was being stored in the same public folder as the old helpdesk form. The problem was that the people who refered to the data wanted the old forms to have the same look as the new forms. The form message class controls this and is stored in each item, so each item needed to be updated to use the new form instead of the old one. The solution at the time was to write a script that would update the form message class for each message.

I may still have the script I used somewhere but I saw this one and it is much nicer then my old one. Download the file code28.zip and extract the zipped files. For this example I am going to change a contact form. Here is the updated one with some extra fields for christmas gift list and so on: