is there anyone who knows how to create a PDF file of the active worksheet
through VBA code ?
I tried many examples found on the net with no success...
If you have full Acrobat (not just the Reader), you can use several
methods:
1) Set the active printer to Distiller and simply use the method
..Printout - from memory, that will present a problem regarding the
filename selection
2) Adobe Distiller provides its own print method: FileToPDF.
If you don't have full Acrobat, you could use Ghostscript and RedMon.
Then you have to manipulate the RedMon registry entry which holds the
output filename. This will involve some nasty registry read/write
actions and dealings with the obscure way Excel uses printer names and
ports (different to any other MS Office application).
I have implemented the latter here, where a macro prints a number of
spreadsheets (>10) rapidly to PDF files (saving paper). However, about
once a week that process plays havoc with one particular PC's display:
no refresh in any window -including TaskMgr-, completely nuts.
Like you, I'm looking for a stable add-on which will provide the
equivalent to Adobe's FileToPDF; the full Acrobat is just to expensive
for that. The radical alternative, OpenOffice or Quattro, which both
provide native PDF output, is unfortunately not practical for us. It
might be for you, though.
Let us know if you find anything.