Skip to content

Instantly share code, notes, and snippets.

View guimou's full-sized avatar

Guillaume Moutier guimou

  • Red Hat
  • Québec, Canada
View GitHub Profile
@guimou
guimou / gist:57d6fd5712c0f7672afa7a793ef1f803
Created April 5, 2017 14:38
Macro to delete all Outlook attachments and write deleted filenames in message
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
@guimou
guimou / gist:0150474e9d5a624a5fae701ac4ca7bd3
Created April 5, 2017 14:37
Macro to save all Outlook attachments and write saved location in message
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, _
objFSO As Object, _
@guimou
guimou / gist:3e7b06c36a9247154808b6304a52db3f
Created March 1, 2017 15:17
Opens AD administration from command line (must be in admin mode) with another account
C:\Windows\System32\runas.exe /netonly /user:username@domainname "mmc %SystemRoot%\system32\dsa.msc /domain=domainname"