none
macro for scanning a page usig irfanview and send email RRS feed

  • Question

  • Hello. I want to make a macro to scan a page using irfanview and attach the scanned file to an email using an outlook form.

    Right now I have only the macro bellow but I can't make it to accept the parameters for irfanview. Can anyone help? Thank you.

    Sub test1()
    Dim RetVal
    On Error GoTo ErrorHandler
    RetVal = Shell("C:\Program Files (x86)\IrfanView\i_view32.exe /scan /jpgq=50 /convert=c:\temp\scan50.pdf", 1)

    End
    ErrorHandler:
    If RetVal = 0 Then
        Msg = "File not Found"
    Else
        Msg = Err.Description
    End If
    MsgBox Msg
    End Sub           


    • Edited by dann23 Monday, June 18, 2012 2:34 PM
    Monday, June 18, 2012 8:08 AM

Answers

  • Hi dann23,

    Thanks for posting in the MSDN forum.

    You can pass the parameters after the command line following is a sample:

    Sub test()
        Dim RetVal
        
        RetVal = Shell("C:\Users\****\Documents\Visual Studio 2010\Projects\Test\Test\bin\Debug\test.exe -S -P m=12")
        
    End Sub
    

    And This is the Test project:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace Test
    {
        class Program
        {
            static void Main(string[] args)
            {
                foreach (string arg in args)
                {
                    Console.WriteLine(arg);
                }
                Console.ReadKey();
            }
        }
    }

    And this is the result:


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, June 20, 2012 8:16 AM
    Moderator

All replies

  • there are hundreds of samples on the web, search for a while

    http://support.microsoft.com/kb/161088
    Monday, June 18, 2012 8:55 AM
  • Thank you very much for your help :) the problem is that I don't know how to pass arguments to irfanview using a macro. If someone can point me to an article about passing arguments to a program in a macro then I can use the examples that I did find on the internet.
    • Edited by dann23 Monday, June 18, 2012 2:35 PM
    Monday, June 18, 2012 2:29 PM
  • Hi dann23,

    Thanks for posting in the MSDN forum.

    You can pass the parameters after the command line following is a sample:

    Sub test()
        Dim RetVal
        
        RetVal = Shell("C:\Users\****\Documents\Visual Studio 2010\Projects\Test\Test\bin\Debug\test.exe -S -P m=12")
        
    End Sub
    

    And This is the Test project:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace Test
    {
        class Program
        {
            static void Main(string[] args)
            {
                foreach (string arg in args)
                {
                    Console.WriteLine(arg);
                }
                Console.ReadKey();
            }
        }
    }

    And this is the result:


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, June 20, 2012 8:16 AM
    Moderator