• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

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