Results 1 to 12 of 12

Thread: PDFs and VBA

  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PDFs and VBA

    I have a Word 2000 document which I want to save as a PDF file using VBA. I do have Acrobat Writer and Distiller installed, and I don't want to use it directly.

    Does anyone know how to do it?

    Thanks in advance.

    James

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: PDFs and VBA

    There's code to export Access reports to a PDF format at this http://www.mvps.org/access/reports/rpt0011.htm site. You may be able to adapt it to Word, although I believe it assumes/requires Acrobat.
    Charlotte

  3. #3
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: PDFs and VBA

    You can record a macro of creating a PDF the way you would like and then have a look at the code to figure out what you need to modify for your final code.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDFs and VBA

    Thanks for the suggestion, Andrew, but I've been there, done that, and got only part of what I was looking for.

    Unfortunately, it still reuires a certain amount of user interaction, something which I need to avoid as far as possible.

    James

  5. #5
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDFs and VBA

    Thanks a million! I've had a quick glance at it and it might just be what I need.

    I'll let you know as soon as I've finished testing it.

    Thanks again!

    James

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: PDFs and VBA

    Hope it works out for you.
    Charlotte

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

    Re: PDFs and VBA

    James,

    What version of Acrobat are you using? Acrobat 4.05 comes with all the macros you need and many more than you could ever develop unless you were a whiz at both VBA and the Distiller API. It is installed when you installed Acrobat (unless you asked the Acrobat installation not to do it or you installed word after you installed Acrobat).

    Acrobat 3 had a separate, but free macro that you could download from Adobe that does the same thing.

    Another easy way to do this is to open the word document directly in Acrobat 4.05. Acrobat automatically fires up distller and converts any MS Office file.

    You can also accomplis the same thing by clicking on the Word doc in explorer and dragging and dropping it on the Acrobat icon on yur desktop. Acrobat will fire up, distill the file and display it.

    Unless I am misreading your question, this job has already been done for you. Don't reinvent the wheel.

  8. #8
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDFs and VBA

    I am using version 4.05.

    Maybe I didn't quite phrase it correctly. Acrobat and Distiller 4.05 require user intervention.

    I need to be able to do it without any user intervention. And I don't see the point of reinventing the wheel, thats why I'm asking if anyone knows how to do it.

  9. #9
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDFs and VBA

    Does this Adobe help fire here give you any hints? I appreciate it applies initially to multiple documents and doesn't refer to VBA, but might gives some clues as to a method.

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

    Re: PDFs and VBA

    I don't know how much control you want to have. If you want an easy way, just write code to

    <pre>store your current printer seletion to a vairable
    switch to PDF Writer
    do a file print default
    switch back to your stored printer selection
    </pre>


    If your PDF writer asks for a destination file, you can turn this off. The adobe site has instructions.

    If you want to put more control into your code, you should go to the Adobe site and download the Acrobat SDK. The part of the SDK that you want to look at is the IAC (Inter Application something-or-other) section that deals with interapplication issues. There is an entire section devoted to VB.

    By the way, the PDFMaker macros for Excel offer the simple approach that I suggested above. I don't think the code is protected if you want to look at it.

  11. #11
    New Lounger
    Join Date
    Jan 2001
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDFs and VBA

    There's a sample module that does exactly what you want on the Office2000 Developer disk in the code samples. I stumbled across it last week. Look in odetools/v9/samples/opg/samples

    Mark Cramer

    I can't remember what chapter it was in, but it's in an excel sample.

  12. #12
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington (Greater Manchester area)/Cheshire, UK
    Posts
    153
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDFs and VBA

    Thanks a million, Mark! I found it!

    I dived into a friend's Office 2000 Developer CD and found it. I also found solutions to two other problems I had and one or two other potential problems.

    James

Posting Permissions

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