Results 1 to 5 of 5
  1. #1
    SierraJuliet's Avatar
    SierraJuliet is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2017
    Location
    Earth
    Posts
    211

    Print to PDF

    What is the VBA extension to publish a form to PDF instead of printing. The specific item I am looking to activate is "External Data > PDF or XPS"



    I am looking for something similar to:
    "Linked Table Manager" VBA code - DoCmd.RunCommand acCmdLinkedTableManager
    "ODBC Database" VBA code - DoCmd.RunCommand acCmdImportAttachODBC

  2. #2
    SierraJuliet's Avatar
    SierraJuliet is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2017
    Location
    Earth
    Posts
    211
    This is the VBA code for "External Data > PDF or XPS" feature

    Code:
    DoCmd.RunCommand acCmdExportFixedFormat

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Shouldn't need to activate a library. You can use: DoCmd.OutputTo

    If you want to open the Print dialog and select something like 'Microsoft Print to PDF' driver: DoCmd.RunCommand acCmdPrint

    Otherwise, executing ribbon button might be possible with CommandBars.ExecuteMSO. The only one I know about is:

    CommandBars.ExecuteMSO "DataRefreshAll"

    I can't figure out the reference for External Data PDF/XPS button.

    And I see now you found a RunCommand reference. Great!
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    SierraJuliet's Avatar
    SierraJuliet is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2017
    Location
    Earth
    Posts
    211
    If I did DoCmd.OutputTo then I would need to specify a directory and would prefer the user to choose for flexibility. The aforementioned code I submitted as the solution performs all the same functions and includes flexibility with directory selection with minimum coding required.

    Code:
    DoCmd.RunCommand acCmdExportFixedFormat
    This is a list of acCmd enumerations for those who are interested in streamlining their code - https://docs.microsoft.com/en-us/off...cess.accommand

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Could use fsoFileDialog to allow user to select destination but I suppose you already know about it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 12-13-2018, 01:06 PM
  2. Replies: 5
    Last Post: 07-29-2014, 01:05 PM
  3. Replies: 6
    Last Post: 03-01-2014, 07:07 AM
  4. Replies: 5
    Last Post: 10-26-2011, 02:59 PM
  5. Replies: 0
    Last Post: 02-22-2011, 05:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums