Showing results 1 to 6 of 6

Thread: send file to printer

  1. #1
    Join Date
    29.07.2007
    Location
    Linz
    Posts
    50

    Default send file to printer

    hi,
    I have to print a file. This file is automatically generated with a VBA procedure. The print job should be triggered with VBA too.
    How do I define the printer and send the content to the printer queue?

    Regards,
    alex

  2. #2
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: send file to printer

    Unfortunately VBA does not support the "Printer" object like VB does.

    As far as I can see you have 2 options:

    Reading textfile Line-by-Line and print Line-by-Line:
    - loop though the textfile
    - catch one line and directly print it to the printer using following code:
    http://support.microsoft.com/?scid=k...98141&x=12&y=9


    Or via notepad (using shell commands):

    notepad.exe /p C:\MyTextFileToPrint.txt
    -> so combining with the "Shell" command within VBA
    Shell("c:\winnt\system32\notepad.exe /p C:\MyTextFileToPrint")

    Hope this helps,
    Herbert

  3. #3
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: send file to printer

    If you want to print the text file using a zenon standard functionality you can use the picture type "List" for this.

    If the desired textfile is loaded into this picture it is also possible to print this text file out to the printer (which has been defined as printer for "Lists").

    Regards,
    Herbert

  4. #4
    Join Date
    29.07.2007
    Location
    Linz
    Posts
    50

    Default AW: send file to printer

    I used the shell comand and a third party program to get my file to the disired pdf printer.

    thanks for the hints.

    regards,
    alex

  5. #5

    Default Re: send file to printer

    maybe also printing a report (which contains the information, instead of a text file), to a PDF printer (with automatic file saving) would have been an option.

  6. #6
    Join Date
    29.07.2007
    Location
    Linz
    Posts
    50

    Default AW: Re: send file to printer

    Quote Originally Posted by MarkClemens View Post
    maybe also printing a report (which contains the information, instead of a text file), to a PDF printer (with automatic file saving) would have been an option.
    this was my first approach. I tried to use the COM Interface of PDFCreator. But PDFCreator expexts a PostScript file to print my report (xhtml file containing multiple SVG objects). So I would have had to create the PS file first, then send it to PDFCreator --> automatically creating of the PS file requires an "automatic print job" which was my original problem.

    Nevertheless I' m satisfied with the current solution.

    regards,
    alex

Similar Threads

  1. Replies: 1
    Last Post: 25th July 2013, 11:07
  2. How to set the printer in Runtime
    By dragosmoss in forum zenon Supervisor
    Replies: 7
    Last Post: 24th May 2009, 19:00
  3. Send To Hardware in 6.22
    By madphilly in forum VBA
    Replies: 4
    Last Post: 22nd September 2008, 15:06
  4. send value to hardware
    By dak2483 in forum Drivers
    Replies: 7
    Last Post: 19th September 2008, 16:33

Posting Rules

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