Solved

1-click Outlook 2007/2010 "attach" vs "Insert" for forwarding email

Posted on 2010-11-10
10
543 Views
Last Modified: 2012-06-21
I am frequently switching between attaching a forwarded message and including a forwarded message. Instead of going through the multiple menus in OL2007/2010, I would like: (1) an icon I can place on a toolbar, and (2) a keyboard shortcut to make this change.
0
Comment
  • 5
  • 4
10 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 34115470
Hi, doug-jensen.

The macro below will do this.  Follow these instructions to add the code to Outlook 2007 (I don't have a set of instructions for 2010).

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects
4.  If not already expanded, expand Modules
5.  Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7.  Edit the code as needed.  I included comments wherever something needs to or can change
8.  Click the diskette icon on the toolbar to save the changes
9.  Close the VB Editor

Follow these instructions to add the macro to a toolbar (again I don't have instructions for Outlook 2010).

1.  Click View > Toolbars > Customize
2.  Click the Toolbars tab
3.  Click New
4.  Name the toolbar
5.  Click the Commands tab
6.  Under Categories click Macros
7.  Under Commands click and hold on the macro, then drag it out and drop it on the new toolbar
8.  Dock the toolbar somewhere onscreen

You can assign a keyboard shortcut (i.e. a hotkey) by placing an ampersand in front of some letter in the name.  Remember not select a letter that's already in use.


Sub ToggleForwardAction()
    Const REG_KEY = "HKCU\Software\Microsoft\Office\%VERS%\Outlook\Preferences\ForwardStyle"
    Const SCRIPT_NAME = "Toggle Forward Action"
    Dim objShell As Object, intCurrent As Integer, strVersion As String, strKey As String, strAction As String
    strVersion = Application.VERSION
    strVersion = Left(strVersion, 2) & ".0"
    strKey = Replace(REG_KEY, "%VERS%", strVersion)
    Set objShell = CreateObject("WScript.Shell")
    intCurrent = objShell.RegRead(strKey)
    Select Case intCurrent
        Case 1  'Attach original message'
            objShell.RegWrite strKey, 2, "REG_DWORD"
            strAction = "Include original message"
        Case 2  'Include original message
            objShell.RegWrite strKey, 1, "REG_DWORD"
            strAction = "Attach original message"
    End Select
    Set objShell = Nothing
    Msgbox "Forwarding action now set to """ & strAction & """.", vbInformation+vbOkOnly, SCRIPT_NAME
End Sub

Open in new window

0
 

Author Comment

by:E. Douglas (Doug) Jensen
ID: 34117348
Thank you. Unfortunately the forwarded message is always included either way the icon is toggled.

--Doug
0
 

Author Comment

by:E. Douglas (Doug) Jensen
ID: 34117447
I don't want to restart OL to change the setting :) Thank you for your effort.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 34117483
Yeah, I understand.  Not suggesting that you should.  Just pointing out that if Outlook only reads the setting when it loads, then toggling the setting isn't going to work.  Unfortunately, there is no means I know of to change the setting other than writing to the registry.  The only other solution I can offer is to use two macros that emulate the two different forwarding actions.  Rather than toggling a setting and then using the built-in forward you'd run the macro that forwarded the way you want it to.  I can help with that if you want to take this approach.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:E. Douglas (Doug) Jensen
ID: 34117493
I'm up for that, let's give it a try. Thank you.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 34133176
Ok, here's the code for the two types of forwarding.  Be sure to set the default forwarding action to "Include original message text".  Once you've added the code to Outlook you can create two shortcuts, one that fires each macro.
Sub ForwardInline()
    Dim olkItm As Object, olkFwd As Outlook.MailItem
    For Each olkItm In Application.ActiveExplorer.Selection
        If olkItm.Class = olMail Then
            Set olkFwd = olkItm.Forward
            olkFwd.Display
        End If
    Next
    Set olkItm = Nothing
    Set olkFwd = Nothing
End Sub

Sub ForwardAsAttachment()
    Dim olkItm As Object, olkFwd As Outlook.MailItem
    For Each olkItm In Application.ActiveExplorer.Selection
        If olkItm.Class = olMail Then
            Set olkFwd = Application.CreateItem(olMailItem)
            olkFwd.Subject = "FW: " & olkItm.Subject
            olkFwd.Attachments.Add olkItm
            olkFwd.Display
        End If
    Next
    Set olkItm = Nothing
    Set olkFwd = Nothing
End Sub

Open in new window

0
 

Author Comment

by:E. Douglas (Doug) Jensen
ID: 34169807
My apologies for the delay in trying this, I am up to my eyeballs in short deadline stuff at work, I'll try it this weekend for sure. Thank you.

--Doug
0
 
LVL 76

Expert Comment

by:David Lee
ID: 34169958
No worries.
0
 

Author Comment

by:E. Douglas (Doug) Jensen
ID: 34184132
You might be over-estimating my competence :) I cut and pasted the new code into the previous macro and saved it and closed the editor.

1. The previous macro toolbar "project1" is still there with one button "Project1.ToggleForwardAction"
I want to remove it but if I uncheck its name "attach-include" nothing happens. I have both "attach-include" and "include attach," I'm not sure which one I just created and named which name.

2. The new macro is named "incude-attach" and there is one named "attach-include" that I think is the old one. Now View->Toolbars shows two toolbar choices, "attach-include" and "include-attach."I added the two buttons that were available "Project1,ForwardAsAttachment" and "Project1.Forwardinline" to "include-attach" since I'm sure that is the new one because you said to make include the default.

3. If I use View->toolbars I can enable either or both "include-attach" and "attach-include." "attach-include has no buttons.

4. With include as the default, the forwarding always includes and clicking the ForwardAsAttachment button does not work.

Please advise what all the mistakes are that I made. Thank you.


0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
In this article we will discuss some EI Capitan Mail app issues and provide some manual process to resolve them.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now