Save / Extract Outlook Attachments from emails and save them to a Folder

I have been meaning to post this for a while.
Some VBA code to extract attachments from a folder in Outlook and save them.

You can choose the Outlook folder but it is hard coded to save the attachments to C:\Email Attachments\
Sub AttachDetach()
‘ *******************************************************************************
‘ Name – AttachDetach
‘ Description – Removes Attachements from an Outlook Folder and saves them to C:\Email Attachments\
‘ Date Changed – 10/03/2011 <– Please keep this up to date
‘ Changed by – Dan Thomas  <– Please keep this up to date
‘ *******************************************************************************

Dim ns As NameSpace

Dim Inbox As MAPIFolder

Dim item As Object

Dim Atmt As attachment

Dim filename As String

Dim i As Integer

Set ns = GetNamespace(“MAPI”)

Set Inbox = ns.PickFolder

i = 0

If Inbox.Items.Count = 0 Then

MsgBox “There are no messages in the Inbox.”, vbInformation, _

“Nothing Found”

Exit Sub

End If

For Each item In Inbox.Items

For Each Atmt In item.Attachments

filename = “C:\Email Attachments\” & i & Atmt.filename

Atmt.SaveAsFile filename

i = i + 1

Next Atmt

Next item

If i > 0 Then

MsgBox “I found ” & i & ” attached files.” _

& vbCrLf & “I have saved them into the C:\Email Attachments folder.” _

& vbCrLf & vbCrLf & “Have a nice day.”, vbInformation, “Finished!”


MsgBox “I didn’t find any attached files in your mail.”, vbInformation, _


End If


Set Atmt = Nothing

Set item = Nothing

Set ns = Nothing

End Sub

Microsoft Outlook – Keep zoom setting when reading emails

Open up Outlook
Press Alt and F11

Navigate to:
Project1 | Microsoft Outlook Objects | ThisOutlookSession

Paste the code below in (about 52 lines)

'  --- Start Copy Here ---
'* The code below changes the zoom for reading and writing e-mails *
'* Written By: Dan Thomas                                          *
'* Date: 30th Oct 2012                                             *
Option Explicit
' For more information on the below varibles please see
Dim WithEvents objOLInspectors As Outlook.Inspectors   'Define the Outlook Inspectors varable
Dim WithEvents objOLMailItem As Outlook.MailItem       'Define the Outlook Mail Item varible
Dim WithEvents objOLOpenInspector As Outlook.Inspector 'Define the Outlook Inspector varable

Private Sub Application_Startup()
' Set the Inspectors object to the objOLInspectors varible at start of application
' This will generate a warning to ask if you want to enable Macros when starting Outlook within Airbus
Set objOLInspectors = Application.Inspectors
End Sub

Private Sub Application_Quit()
' Sets all the varibles to nothing when quitting outlook
Set objOLInspectors = Nothing
Set objOLOpenInspector = Nothing
Set objOLMailItem = Nothing
End Sub

Private Sub objOLInspectors_NewInspector(ByVal Inspector As Inspector)
' This sets the objects to varibles when opening mails
If Inspector.CurrentItem.Class = olMail Then
Set objOLMailItem = Inspector.CurrentItem
Set objOLOpenInspector = Inspector
End If
End Sub

Private Sub objOLOpenInspector_Close()
' Clears the varibles when closing e-mails
Set objOLMailItem = Nothing
End Sub

Private Sub objOLOpenInspector_Activate()

'For Office 2007
'Dim wrdDoc As Word.Document

'For Office 2010
Dim wrdDoc As Object

' For the below to work you have to go to Tools|References... and make sure the Microsoft Office 14.0 Object Library has been selected
Set wrdDoc = objOLOpenInspector.WordEditor ' Sets the wrdDoc Varible to the Word Editor object

' Set the number at the end of this line for zoom amount
wrdDoc.Windows(1).Panes(1).View.Zoom.Percentage = 145
End Sub
'  --- End Copy Here ---

Click save
Check that Tools|References... and make sure the Microsoft Office 14.0 Object Library has been selected
If you have Outlook 2007 you may have to activate the line that says Dim wrdDoc As Word.Document
and rem the line that says Dim wrdDoc As Object

Close outlook and restart

Cisco Router stuck in rommon

If you try to power cycle some types of Cisco routers then you may get it stuck in rommon.

It will generally flash a red light at you and when you try to Telnet into it the command prompt will display romon 1>

Just simply type in
confreg 0x2102
Then press the enter key and then type in

The router should then boot up as normal.