Juice
New member
- Local time
- Today, 14:14
- Joined
- Jan 20, 2025
- Messages
- 6
Hi everyone!
Here are the basics: I have an .html file that i want to print to pdf.
Specs: Win 10, 2003 office
The code below is what I try to use to print, but it always gives me error 31. From what i understand error 31 means windows dont have a designated app for .html. I checked and it does so iam looking for alternatives, preferable not third party solutions. Also i tested the code with a pdf file and works that way. Also set chrome, firefox and edge too to be the designated app to .html, but no luck.
Now for the long part:
I have an automation that uses word templates to generate letters and print it to pdf to be sent out to customers. I generate roughly a 100 a day, and one is about 13-15 seconds to make. Since reports dont have the the normal kind of justify and other featuers like make one part of the text bold and such (basicly its not preaty for the company) , word templates was the solution.
Since DDE is not been usable for a while and behind the older querys (started with office 97), i got a lot of code, i was looking for other solutions and i had 2 ideas. Also i planing to go higher on the office version, just need to clear out this kind of problems (macros, code in query, etc), since microsoft hell bent on security.
The first one was to run a query to make a table and wire that table to a word template, merge it and then separate to pdf files and make an automation to file it in the system and send it out. Thats done but i have like 10+ different templates and its still a pain in the ass, because it nedds a lot of separate steps for each letter template. Some templates only needs basic customer data, but some have concatenadet stuff, calculations
So my fantasticly dumb ide was to make bot that runs trough a task list, figure out which kind of letter is needed based on the task name, generate an html and make a pdf and file it. It runs realy fast (like a second), but cant make a pdf...
Here are the basics: I have an .html file that i want to print to pdf.
Specs: Win 10, 2003 office
The code below is what I try to use to print, but it always gives me error 31. From what i understand error 31 means windows dont have a designated app for .html. I checked and it does so iam looking for alternatives, preferable not third party solutions. Also i tested the code with a pdf file and works that way. Also set chrome, firefox and edge too to be the designated app to .html, but no luck.
Code:
ShellExecute(0, "Print", "c:\1\test.html", 0, 0, SW_HIDE)
Now for the long part:
I have an automation that uses word templates to generate letters and print it to pdf to be sent out to customers. I generate roughly a 100 a day, and one is about 13-15 seconds to make. Since reports dont have the the normal kind of justify and other featuers like make one part of the text bold and such (basicly its not preaty for the company) , word templates was the solution.
Since DDE is not been usable for a while and behind the older querys (started with office 97), i got a lot of code, i was looking for other solutions and i had 2 ideas. Also i planing to go higher on the office version, just need to clear out this kind of problems (macros, code in query, etc), since microsoft hell bent on security.
The first one was to run a query to make a table and wire that table to a word template, merge it and then separate to pdf files and make an automation to file it in the system and send it out. Thats done but i have like 10+ different templates and its still a pain in the ass, because it nedds a lot of separate steps for each letter template. Some templates only needs basic customer data, but some have concatenadet stuff, calculations
So my fantasticly dumb ide was to make bot that runs trough a task list, figure out which kind of letter is needed based on the task name, generate an html and make a pdf and file it. It runs realy fast (like a second), but cant make a pdf...