Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-02-10
5
Medium Priority
?
357 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 37

Expert Comment

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

Author Comment

by:willsherwood
ID: 34864912
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 2000 total points
ID: 34870287
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
ID: 34870743
a great approach, thanks!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 34871258
You're welcome.  Glad I could help.
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
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: …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

610 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