Results 1 to 2 of 2

Thread: [2005] Printing File To Printer

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2005
    Location
    Bournemouth
    Posts
    63

    [2005] Printing File To Printer

    Hey,

    Does anyone know how to send a file directly to the printer, no matter what the file type is? I have a set of files currently that I double click on and they are sent directly to the printer. Or I am asked to define the file type. Can this be done in VB. Either printing direct to the printer, or performing a double click type scenario on the file through VB?
    Last edited by andyb7901; May 31st, 2007 at 05:48 AM.

  2. #2
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: [2005] Printing File To Printer

    This code to work needs the file type to associated.
    In this example you need to have Excel or Office installed.
    Code:
            Dim strFile As String= "c:\test.xls"
            Dim objProcess As New System.Diagnostics.ProcessStartInfo
    
                With objProcess
                    .FileName = strFile
                    .WindowStyle = ProcessWindowStyle.Hidden
                    .Verb = "print"
                    .CreateNoWindow = True
                    .UseShellExecute = True
                End With
                Try
                    System.Diagnostics.Process.Start(objProcess)
                Catch ex As Exception
                    MessageBox.Show(ex.Message)
                End Try
    "The dark side clouds everything. Impossible to see the future is."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width