Solved

Windows XP & 7  Outlook (2007) Email attachments - opening in applications

Posted on 2011-02-10
5
347 Views
Last Modified: 2012-05-11
How can i drag an attachment (as if it were already a windows filesystem file) and drop into an application for opening from an Outlook message.
Currently i have to use some waystation to launder it to get a file handle and then drag that into an application.
Currently I have to SAVE-AS the file first:  For instance, dragging to desktop or filing someplace and then going thru the motions to SAVE AS again, but when the dialog Choose File comes up, click on the now-visible  same file that i just put there and then drag that file handle into the application to open it.

This seems like a simple thing for Outlook and/or Windows to do behind the scenes to make a file "available" via a convenient dragging operation.

0
Comment
Question by:willsherwood
  • 2
  • 2
5 Comments
 
LVL 37

Expert Comment

by:Neil Russell
Comment Utility
Why not just create a file association and the double click the attachment?
0
 

Author Comment

by:willsherwood
Comment Utility
yes that would normally work fine.
However, for the cases that i have as a graphic designer, i may want to open PDFs in Photoshop (in order to convert)  or a zip file in stuffit, etc.

An alternative would be to find out how to add to the right click context menu to include OpenWith for choices - that would cover 90% of the situations...

thanks
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
Comment Utility
Hi, wilsherwood.

It's possible to do this with a bit of scripting.  The script below will add an item to the file attachment context menu that opens the selected item in Microsoft Word.  You can add as many selections as you think is practical.

Follow these instructions to add the code to Outlook.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
5.  Edit the code as needed.  I included comment lines wherever something needs to or can change
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Click Tools > Trust Center
9.  Click Macro Security
10. Set Macro Security to "Warnings for all macros"
11. Click OK
12. Close Outlook
13. Start Outlook.  Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.


Dim objSelectedAttachments As AttachmentSelection

Private Sub Application_AttachmentContextMenuDisplay(ByVal CommandBar As Office.CommandBar, ByVal Attachments As AttachmentSelection)
    Dim ofcBtn As Office.CommandBarButton
    Set objSelectedAttachments = Attachments
    '--- Duplicate this block of code once for each menu selection you want to add ---'
    Set ofcBtn = CommandBar.Controls.Add(msoControlButton, , , , True)
    With ofcBtn
        .Style = msoButtonCaption
        '--- On the next line, edit the caption as needed ---'
        .Caption = "Open with Word"
        '--- On the next line change the procedure name to match the procedure that will open this type of file ---'
        .OnAction = "Project1.ThisOutlookSession.OpenWithWord"
    End With
    '--- End block ---'
    Set ofcBtn = Nothing
End Sub

'--- Create a procedure like this for each different opener ---'
Sub OpenWithWord()
    '--- On the next line change the name/path of the executable that will open this type of file ---'
    Const CMD_LINE = "Winword.exe"
    Dim objShell As Object, objItem As Object, strTempFolderPath As String
    strTempFolderPath = Environ("TEMP")
    Set objShell = CreateObject("WScript.Shell")
    For Each objItem In objSelectedAttachments
        objItem.SaveAsFile strTempFolderPath & "\" & objItem.FileName
        objShell.Exec CMD_LINE & " " & strTempFolderPath & "\" & objItem.FileName
    Next
    Set objShell = Nothing
End Sub

Open in new window

0
 

Author Closing Comment

by:willsherwood
Comment Utility
a great approach, thanks!
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
You're welcome.  Glad I could help.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
Set OWA language and time zone in Exchange for individuals, all users or per database.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

762 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

9 Experts available now in Live!

Get 1:1 Help Now