• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:


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 ??
  • 3
  • 2
1 Solution
You could try using the SENDKEY function of VB6 to address the PDF prompt problem.
BIAPROAuthor Commented:
This syntax is new to me,  please a sample how to use?
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.

BIAPROAuthor Commented:
Now I got the idea, very handy, this was unknown to me, can use this for a lot off other things, thanks!
BIAPROAuthor Commented:
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now