Results 1 to 6 of 6
  1. #1
    RyanP is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    60

    DoCmd.OutputTo acOutputReport using Windows Save As Dialog Box, meanwhile setting file name

    I want the built in Save As dialog to be used for the export, however I want to set the default file name as well. I cannot seem to do both at once...

    strFileName = A predefined File Name with no Path set. "Default Title for the Export" & strRecordID "Date" and "Logged On User" & ".pdf"
    Not an issue here.. works fine


    With the following code, the file is exported to the last location where I saved a file. No prompt

    DoCmd.OutputTo acOutputReport, , acFormatPDF, strFileName, False, , , acExportQualityScreen

    With the following code, the Save As Dialog opens but I obviously do not have a custom / default file name...

    DoCmd.OutputTo acOutputReport, , acFormatPDF, , False, , , acExportQualityScreen

    If I set any default path to use in lieu of a wild card, then I do not get the Save As with the Autostart check box

    I've reviewed the many of the options in online threads but none seem to leave it up to Windows for the Save As dialog...

    How do I set a default file name / prompt for a save location meanwhile using the Windows built in Output To dialog box (with the AutoStart checkbox)
    Or even better, have the the Publish as PDF or XPS dialog box that you get when manually exporting a report to PDF. (with the 'Open File after Publishing and optimization check boxes)


  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,863
    I think what you are looking for is msoFileDialogFolderPicker

    So it would start off like this ...
    Code:
    With Application.FileDialog(msoFileDialogFolderPicker)
    ' Set the dialog title
    .Title = "Locate a folder to export"
    ' Set the button caption
    .ButtonName = "Choose"
     
    .InitialFileName = "C:\"

  3. #3
    RyanP is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    60
    thx... ive been using the Application.FileDialog(msoFileDialogSaveAs) but am looking to call on the 'Publish as PDF or XPS' dialog... the default Save As box doesn't give the user the autostart option ('Open file after publishing' and optimization and other PDF publishing options)

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,863
    I am not sure what you are getting at, specifically. It seems you want to have something that is part of the Windows Shell and not just a file picker. I suppose there is a way to call the shell and get the dialog to open a specific file and open it using a specific application/executable. I have never had a need to do this in an Access application.

    Within Access, what I will typically do is automate all of this. The User does not have any say in the matter. When you create a Business Solution, you want the application to manage everything. So most of the tools available are going to automate the process and the application will make the decisions about file paths, application types, etc.

    If you are giving the user an opportunity to export data for their own use, let them choose the folder where to store it. This makes sense because the user is going to take ownership of the data. For this, I use the code posted in post #2. I save the path as a string variable for later use. If you want to give the user options about the file name and type, collect that information separately. Use a text box to collect the file name they want to use. Use an Option Group to let them choose the file format. After you have the user input, automate the process using the variables.

    I have created various modules that let users scan and store documents. Sometimes they get to choose what happens with the documents being scanned. Sometimes they do not have any options. If I want to provide them an option to view documents after the process, I will use something along the lines of executing an hyperlink to launch the app and open the document/file. I simply use the variables stored in memory.

  5. #5
    RyanP is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    60
    ItsMe - "I am not sure what you are getting at, specifically."

    Looking to have Access programmatically initiate the export report process using the 'Publish as PDF or XPS' dialog box with the 'Open file after publishing', and PDF optimization options 'Standard (publishing for inline and printing)' & 'Minimize size (publishing online)' and the other PDF options as well. (none of which are in the standard 'Save As' dialog box) Meanwhile setting the default file name. Application.FileDialog(msoFileDialogSaveAs) works, but doesn't have the PDF publishing options.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,863
    If you are focusing on how a PDF is rendered and not what the path to the directory is, you will need to Automate Acrobat. Some features may not be available via Acrobat. For instance, you may need to Automate Illustrator to render an SVG and save a copy as PDF.

    If you have a full version of Acrobat, you may be able to accomplish what you need using VBA to automate Acrobat. This is a similar to automating Outlook. However, documentation for Automating Acrobat is, well, fun to interpret.

    You might want to start here.
    https://www.accessforums.net/code-re...ust-43211.html

    Or here
    https://www.accessforums.net/modules...tml#post279119

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

Similar Threads

  1. file picker dialog and docmd transfer database table
    By REBBROWN in forum Programming
    Replies: 3
    Last Post: 08-11-2014, 02:12 PM
  2. Dialog windows and file requestor
    By daveinuk in forum Programming
    Replies: 1
    Last Post: 03-06-2014, 07:09 AM
  3. Save As dialog box exporting Excel file
    By accessnewbie in forum Access
    Replies: 1
    Last Post: 03-09-2013, 03:15 PM
  4. DoCmd.OutputTo acOutputReport
    By GraeagleBill in forum Reports
    Replies: 11
    Last Post: 09-15-2012, 07:33 PM
  5. DoCmd.OutputTo
    By tylerg11 in forum Reports
    Replies: 2
    Last Post: 08-09-2012, 12:22 PM

Tags for this Thread

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