Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Location
    Houston, Texas
    Posts
    74

    Unanswered: Prompt for Saving Location

    Hi,

    I am using following code to export PDF and it's working fine.

    1. How do I prompt for location ? (like what drive or directory to save, end user will nagivate this)

    2. How do I prompt a Msgbox "No data to print" if there is nothing to print.

    Thanks

    = = = = Working Code = = = =
    Private Sub cmdSaveReportAsPDF_Click()

    If ValidateRptData() = True Then
    Dim ReportName As String
    Dim FileName As String
    Dim DateToday As Date

    DateToday = Date
    ReportName = "rptNP_Main"
    FileName = ReportName & " - " & Format(DateToday, "mm-dd-yyyy") & ".pdf"

    Call SaveReportAsPDF("rptNP_Main", FileName)
    MsgBox "Export completed"
    End If

    End Sub

  2. #2
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    To prompt for a location like most windows programs, use the Common Dialog Box. In design mode on the form, click the icon in your toolbox that is a hammer and a wrench and says "More Controls." Go down to the Microsoft Common Dialog Control 6.0.

    I only have a partial install on my system, so I can't use it, but I believe the code should resemble the following:
    Code:
        With cdl
        .Filter = "Adobe PDF Files (*.pdf)|*.pdf|"
        .FilterIndex = 1
        .CancelError = True
        .InitDir = App.Path
        .FileName = strFileName    'a default filename, if desired
    End With 
    
    cdl.ShowSave
    after the user presses "Save," the selected path & filename can be stored in strTemp (or any other variable) by:
    Code:
    strTemp = cdl.FileName
    hope this helps.

  3. #3
    Join Date
    Dec 2002
    Location
    Houston, Texas
    Posts
    74

    error

    gettting an error with cdl line

    what is cld ?

  4. #4
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    my fault. you should name your Common Dialog Box that you add to your form "cdl"

Posting Permissions

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