Solved

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

Posted on 2010-11-10
10
553 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you having trouble connecting or getting your iPhone / Samsung device(s) to sync with Microsoft Exchange Server?   What have you tried?   What haven't you tried?
In this article we will discuss some EI Capitan Mail app issues and provide some manual process to resolve them.
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: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

932 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

16 Experts available now in Live!

Get 1:1 Help Now