Solved

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

Posted on 2011-02-10
5
350 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
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 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
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 …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

839 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