Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / September 2005

Tip: Looking for answers? Try searching our database.

Keyboard shortcut to open Outlook attachment

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mo430 - 07 Sep 2005 20:36 GMT
Is there a keyboard shortcut or vba macro code to open an Outlook attachment
within a message instead of double clicking using the mouse?
Ken Slovak - [MVP - Outlook] - 08 Sep 2005 16:41 GMT
Not that I know of.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Is there a keyboard shortcut or vba macro code to open an Outlook
> attachment
> within a message instead of double clicking using the mouse?
Eric Legault [MVP - Outlook] - 08 Sep 2005 17:03 GMT
The hard way is to save the attachment to disk, then call the Shell function
to launch it.  However, you need to know the path to the file's .exe handler.
Even that is tricky, because the argument specifications for the .exe could
be unique.  There's also no way that I know of to retrieve the .exe path of a
registered application for a particular file extension.

Signature

Eric Legault - B.A, MCP, MCDBA, MCSD (VS 6.0), Outlook MVP
Try Picture Attachments Wizard - http://tinyurl.com/ckytm
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/

> Not that I know of.
>
> > Is there a keyboard shortcut or vba macro code to open an Outlook
> > attachment
> > within a message instead of double clicking using the mouse?
Michael Bauer - 09 Sep 2005 07:05 GMT
Am Thu, 8 Sep 2005 09:03:02 -0700 schrieb Eric Legault [MVP - Outlook]:

Hi Eric,

if there´s a registered app for a file extension then you don´t need the exe
handler. Just call ShellExecute with the file´s path and, e.g., the "open"
command.

Signature

Viele Gruesse / Best regards
Michael Bauer - MVP Outlook

> The hard way is to save the attachment to disk, then call the Shell function
> to launch it.  However, you need to know the path to the file's .exe handler.
>  Even that is tricky, because the argument specifications for the .exe could
> be unique.  There's also no way that I know of to retrieve the .exe path of a
> registered application for a particular file extension.
Eric Legault [MVP - Outlook] - 09 Sep 2005 15:39 GMT
Good call Michael.  I thought I had figured this out before, but I obviously
forgot!  I think the differences between Shell and ShellExecute has made me
foggy.

Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" _
   (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String _
   , ByVal lpParameters As String, ByVal lpDirectory As String, ByVal
nShowCmd As Long) As Long

Sub OpenFile()
   Dim strFileName As String
   Dim lngRet As Long
   
   strFileName = "C:\Temp\test.doc"
   lngRet = ShellExecute(0, "open", strFileName, "", "", 0)
End Sub

Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" _
   (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String _
   , ByVal lpParameters As String, ByVal lpDirectory As String, ByVal
nShowCmd As Long) As Long

Sub OpenFile()
   Dim strFileName As String
   Dim lngRet As Long
   
   strFileName = "C:\Temp\test.doc"
   lngRet = ShellExecute(0, "open", strFileName, "", "", 0)
End Sub

Signature

Eric Legault - B.A, MCP, MCDBA, MCSD (VS 6.0), Outlook MVP
Try Picture Attachments Wizard - http://tinyurl.com/ckytm
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/

> Am Thu, 8 Sep 2005 09:03:02 -0700 schrieb Eric Legault [MVP - Outlook]:
>
[quoted text clipped - 13 lines]
> of a
> > registered application for a particular file extension.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.