Opening attachments in Outlook

Is there any way to open attachments in Outlook by voice? I'm using NaturallySpeaking professional 8.0, so I can create macros to do it. But I haven't found any shortcut keys or any other combination of keys that will let me open attachments.

Thanks,
Anders

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

This Macro will do it

I don't know how to do it by voice, unless you use a macro.

You will need to include the appropriate object reference to the Outlook library. I use it in Outlook 2000, but I think it will work in other versions.

Name: open attachment <1to10>

__________________________

Dim objAtt As Attachment
Dim objAtts As Attachments
Dim objCurrentMessage As MailItem
Dim attachmentname As String
Dim index As Integer
Dim attachmentnumber As Integer

Sub Main
attachmentnumber = Val(UtilityProvider.ContextValue(0))
Set objCurrentMessage = ActiveInspector.CurrentItem
Set objAtts = objCurrentMessage.Attachments
index = 0
For Each objAtt In objAtts
index = index + 1
If index = attachmentnumber Then
attachmentname = Environ$("TEMP")+"/"+objAtt.FileName
objAtt.SaveAsFile attachmentname
ShellExecute attachmentname, 1, "", "Attachment"
End If
Next
End Sub

Re: This Macro will do it

Hi Matt,

Cool! I was still under the impression that the Outlook VBA did not allow you to access attachments anymore (for security reasons) so I had something but using keystrokes but your version is much better.

I would suggest a small change (once a programmer... Smiling as you could use:

set objAtt = objAtts.item(attachmentnumber)

to replace the foreach loop.

My 2 cents,

Jean-Marc

Which keystrokes?

Hi Jean-Marc,

Which keystrokes did you use?

Thanks,
Anders

Keystrokes command

Here it is:

Commands are:

&lt;saveopen&gt; Attachment
'#Uses "c:\&lt;your_path&gt;\attachment.vba"

<code>
Option Explicit
<code>
Sub Main
Call OpenAttachment (ListVar1)
End Sub

<code>
&lt;saveopen&gt; Attachment &lt;1to20both&gt;
'#Uses "c:\&lt;your_path&gt;\attachment.vba"

<code>Option Explicit

<code>
Sub Main
Call OpenAttachment (ListVar1, ListVar2)
End Sub

And the file ""c:\<your_path>\attachment.vba" is:

Sub OpenAttachment (Action As String, _
Optional Count As String = "0\zero")
<code>
Dim i As Integer
Dim realAction As String
Dim realCount As String
Dim preamble As String
<code>
realCount = Mid(Count, 1, InStr(Count, "\") - 1)
<code>
' Open, save or copy? Extract the first character
realAction = Mid(Action, 1, InStr(Action,"\") - 1)
<code>
preamble = ""
' Current one or specific?
if realCount <> "0" _
Then
' We need to move right 3 for every attachment :-(
i = (CInt(realCount) - 1) * 3
<code>
preamble = "{Right " + CStr (i) + "}"
End If
<code>
' Move to the attachment field.
HeardWord "go", "to", "subject", "field"
SendKeys "{Tab}{Home}{Up 1}", True
<code>
<code>
' Move to the correct attachment
' and Open the popup, select the proper action
SendDragonKeys preamble + "{Shift+F10}" + realAction
<code>
End Sub

And the list:

&lt;saveopen&gt;
c\Copy
o\Open
r\Print
s\Save

Jean-Marc

You are right

Jean-Marc,

Thanks for the improvement. I copied that code from someone else's macro, and didn't review it carefully enough to figure that out.

You can use a small variation in this macro to save a particular attachment to a pre-determined folder, too.

Matt

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.




view recent posts