Consulting

Results 1 to 8 of 8

Thread: printing pdf's i open thru excel vba

  1. #1
    VBAX Regular
    Joined
    Aug 2009
    Posts
    12
    Location

    printing pdf's i open thru excel vba

    I have 2 files(PDF's) that I open via a macro that runs when excel opens (its
    in my start up). Every morning when I get in I print them manually. Can I add
    to that macro so that excel vba tells them to print? I see a lot of stuff on
    printing on google and in help but it all seems to relate to sheets in excel
    and not pdf's or other files you open outside excel.

    Thanks

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You can print them using Acrobat with a Shell command.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Regular
    Joined
    Aug 2009
    Posts
    12
    Location
    I found a solution thank you

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Can you post it for the benefit of others who read this?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    VBAX Regular
    Joined
    Aug 2009
    Posts
    12
    Location
    Well I thought I did but it doesn't work. Still searching.

  6. #6
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    If you have Acrobat Reader, check the version and path for your installation. This should print to your default printer
    [vba]Sub PrintPdf()
    Dim Pth As String
    Pth = "C:\AAA\test.pdf"
    Shell "c:\program files\adobe\reader 9.0\reader\acrord32.exe /p /h " & Pth
    End Sub
    [/vba]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  7. #7
    VBAX Regular
    Joined
    Aug 2009
    Posts
    12
    Location
    Thank you. I can get it to print once its saved. I am trying not to bother saving it but just printing it once I've navigated to it in IE. Where I am having trouble is having it print it(the PDF) while it is open in IE.
    thank you for all your assistance so far.

  8. #8
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Are you using Excel VBA to navigate and open pdf files? If so can you post your code.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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