Re: Printing an Attachment Automatically??

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ken Slovak - [MVP - Outlook] (kenslovak_at_mvps.org)
Date: 12/03/04


Date: Fri, 3 Dec 2004 11:04:57 -0500

The code you posted with your attachment extraction loop looks OK. I would
just add in the loop this:

           For i = lngCount To 1 Step -1
                strFile = strFolder & objAttachments.Item(i).FileName
                objAttachments.Item(i).SaveAsFile strFile
                ShellExecute 0&, "print", strFile, 0&, 0&, 0&
            Next i

The declaration for ShellExecute should be at the module level, above and
subs or functions in that code or class module as follows:

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

'Then this:
Sub Save_Attachments_TESTER_Folder()
    'and so on

-- 
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
"saul kaye" <pharm_x@netvision.net.il> wrote in message
news:41af3931$0$15741$9a6e19ea@unlimited.newshosting.com...
> Thanks Ken, Can you please try and look at the post before this one, as it
> was my most recent one. I am sorry for driving you crazy.
> Yoni


Relevant Pages

  • Re: SHELL Command problem
    ... Shell is a braindead function loosely based on the ShellExecute ... API declaration that I copied in from the API Viewer. ... "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal ...
    (comp.lang.basic.visual.misc)
  • Re: Using Shell Command
    ... > dim lngReturn as long ... Where's the declaration for ShellExecute? ... ShellExecute API are two different things. ...
    (microsoft.public.vb.syntax)
  • Re: Using Shell Command
    ... >> dim lngReturn as long ... > ShellExecute API are two different things. ... > declaration and one possible use for the API. ...
    (microsoft.public.vb.syntax)