Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Feb 2004
    Location
    Carson City, Northamptonshire, Wales
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    automatic pdf creation in Word

    Hi All,

    I would like to create pdf files automatically from within VBA code in Microsoft Word using the distiller printer driver. To make matters a little more complicated, I would like the PDF file to be created in the same directory as where the originating Word document exists with absolutely no intervention on the part of the user.

    I seem to be having a problem using the PrintOut method and determining what the filename parameter needs to be.

    Any help would be appreciated.

  2. #2
    New Lounger
    Join Date
    Dec 2000
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: automatic pdf creation in Word

    Hi Steve,

    I do the following from VBA:

    ActivePrinter = "Acrobat Distiller" ' (or its exact name)
    Activedocument.Printout OutputFilename:=MyPrintFile, PrintToFile:=True

    You would have to set the variable "MyPrintFile" to the path and name you want.

    Hope this helps,

    Cheers,
    Margaret Hassall

  3. #3
    knoway
    Guest

    Re: automatic pdf creation in Word

    If you want to put the resulting PDF file in the same directory as the source, you could initialise the variable "MyPrintFile" as follows:

    Dim MyPrintFile as String
    MyPrintFile = ActiveDocument.Path & _
    Application.PathSeparator & ActiveDocument.Name

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    PA
    Posts
    246
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: automatic pdf creation in Word

    I'm sure that I am missing something here, but why are you trying to reinvent the wheel? The PDFMaker.dot that comes with Acrobat 4.05 does a fantastic job that would take much knowledge of both VBA and Acrobat Distiller and the PDF Document Object Model to reproduce.

    The default installation of Acrobat 4.05 puts the PDFMaker.dot template on your computer. Admittedly, the PDFMaker for Excel is quite lame, but the Word version is fabulous.

  5. #5
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: automatic pdf creation in Word

    Can you tell me how to create a pdf from excel?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •