Posted on 2006-06-07
Last Modified: 2010-04-17
This is flow what I do now and works without needed action
from a user.
From VB6 I write/print data to a predefined Worksheet in Excel
on a map on the  server.
One workstation has a VBprogram running checking once per
minute to see if in this map is a Excel sheet, if yes it
prints it on this station to the FaxPrintermodem, then kills it.
This way all users can Fax.
Now sometimes I have plain (VB6-style printercommands) output,
so looking for a way to print this to a file while keeping
the layout, to my 'fax'-map so the faxprogram then sends same like
excel-file to the  faxmodem.
Important in this case is same like writing excel-page no
useraction needed when printing to some fileformat.
I tried having a PDF creating-printer as active, but that will
allways ask for filename to print-to.
Possible to pass-by ??
Question by:BIAPRO
    LVL 4

    Expert Comment

    You could try using the SENDKEY function of VB6 to address the PDF prompt problem.

    Author Comment

    This syntax is new to me,  please a sample how to use?
    LVL 4

    Accepted Solution

    First, it is SENDKEYS instead of SENDKEY (sorry).  Three is a lot of documentation in VB6 Help.

    Basically, you just enter a string that includes however you would have responded to the prompt of another application that has focus while your program is running.  There are special codes to handle things like then ENTER key, etc.

    Here is an example that they provide in the help utility:

    SendKeys Statement Example
    This example uses the Shell function to run the Calculator application included with Microsoft Windows. It uses the SendKeys statement to send keystrokes to add some numbers, and then quit the Calculator. (To see the example, paste it into a procedure, then run the procedure. Because AppActivate changes the focus to the Calculator application, you can't single step through the code.).

    Dim ReturnValue, I
    ReturnValue = Shell("calc.exe", 1)   ' Run Calculator.
    AppActivate ReturnValue    ' Activate the Calculator.
    For I = 1 To 100   ' Set up counting loop.
       SendKeys I & "{+}", True   ' Send keystrokes to Calculator
    Next I   ' to add each value of I.
    SendKeys "=", True   ' Get grand total.
    SendKeys "%{F4}", True   ' Send ALT+F4 to close Calculator.


    Author Comment

    Now I got the idea, very handy, this was unknown to me, can use this for a lot off other things, thanks!

    Author Comment

    I also tried to use this for the overruling the prompt for printing to a 'file' printer like the pdf printer,
    can't figger out how to this to a application wich will popup after the printer.endoc command, how to send to
    a thing like this a. the filename for pdf-document,  b. no prompt also.
    Any suggestions?

    Regards Jack

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Android App Development

    This course will involve creating widgets, customize list view, grid view, spinners, etc. Creating applications using audio, video, and SQLite database. Ending with publication on Google Play.

    Suggested Solutions

    Title # Comments Views Activity
    tenRun challenge 28 67
    copyEvens challenge 6 46
    sumHeights  challenge 17 50
    Program to display an alert on Windows Toolbar 2 30
    RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
    A short article about a problem I had getting the GPS LocationListener working.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now