killercelery
Programmer
Hi,
I'm trying to change the printer on witch to print a report depending on multiple variables. The printer selection must occur in the code. I considered using APIs such as OpenPrinter, StartDocPrinter, StartPagPrinter, WritePrinter, EndPagePrinter, EndDocPrinter and ClosePrinter, as well as using prtDevMode and prtDevNames, and even writing in Win.ini with WriteProfileString.
The problems are:
for prtDevNames/prtDevMode properties:
I don't have the required information to fill the structs (anybody knows where Windows keeps the printer name, version, driver name...)
for the APIs:
VBA doesn't support pointers, and all the APIs require pointer. I found OpenPrinter witch returns a pointer to the printer, but I can't find anything for a pointer to the report i want to print and for the data to be printed.
for the .ini:
I can write in Win.ini, but it doesn't seem to work thus far, maybe the section or key or value isn't right. Anyway, my boss doesn't want to push this way...
Thanks for any help!!
I'm trying to change the printer on witch to print a report depending on multiple variables. The printer selection must occur in the code. I considered using APIs such as OpenPrinter, StartDocPrinter, StartPagPrinter, WritePrinter, EndPagePrinter, EndDocPrinter and ClosePrinter, as well as using prtDevMode and prtDevNames, and even writing in Win.ini with WriteProfileString.
The problems are:
for prtDevNames/prtDevMode properties:
I don't have the required information to fill the structs (anybody knows where Windows keeps the printer name, version, driver name...)
for the APIs:
VBA doesn't support pointers, and all the APIs require pointer. I found OpenPrinter witch returns a pointer to the printer, but I can't find anything for a pointer to the report i want to print and for the data to be printed.
for the .ini:
I can write in Win.ini, but it doesn't seem to work thus far, maybe the section or key or value isn't right. Anyway, my boss doesn't want to push this way...
Thanks for any help!!