PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Re: Open a pdf file in Outlook

Reply

Re: Open a pdf file in Outlook

 
Thread Tools Rate Thread
Old 12-08-2004, 01:27 AM   #1
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Open a pdf file in Outlook


You need to use a method appropriate to the type of file. Virtually every
file has a print method that's listed in the File Type properties in Windows
Explorer's Tools | Folder Options dialog and that you can invoke with a
shell command. On my machine here, for example, a .pdf file's print action
command looks like this:

"C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe" /p /h "%1"

Your Acrobat version and installation location may vary, of course. But with
that print method, your function could look something like this:

Sub PrintPdfFile(myPath, myFileName)
strFIlePath = Chr(34) & myPath & "\" & myFileName & chr(34)
strAdobePath = Chr(34) & "C:\Program Files\Adobe\Acrobat
5.0\Reader\AcroRd32.exe" & Chr(34)
Set objShell = CreateObject("Wscript.Shell")
objShell.Run strAdobePath & " /p /h " & strFilePath
Set objShell = Nothing
End Sub

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Willy" <Willy@discussions.microsoft.com> wrote in message
news:096F9A71-09A0-484C-8862-707AC5BF7C46@microsoft.com...
> Hello all,
> I'm wanting to write a piece of code that will open a pdf attacment and
> print it out in outlook. Here is the code I currently have:
>
> Sub CheckTimecards()
>

<snip>
> myAttachment(i).SaveAsFile sPath & "\" & sFileName
> If InStr(sFileName, ".pdf") Then
> MsgBox ".pdf file"
> 'Call PrintPdfFile(sPath, sFileName) - need help

with
> 'this function

<snip>


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off