PDF print to (1 Viewer)

Gasman

Enthusiastic Amateur
Local time
Today, 08:18
Joined
Sep 21, 2011
Messages
10,331
Debug.Print


Which is correct. the file extension just does not auto populate to PDF but to All Files

View attachment 95376


I am using 2007-2016 version
Yes, that is due to the function??????

Clue (which if the code was indented would be easy to see?)
Code:
        If lngType <> 2 And lngType <> 4 Then
            'Reset then add filter patterns separated by tildes (~) where
            ' multiple extensions are separated by semi-colons (;) and the
            ' description is separated from them by a comma (,).
            ' Example strPattern :
            ' "MS Access,*.ACCDB; *.MDB~MS Excel,*.XLSX; *.XLSM; *.XLS"

            .filters.Clear
            For Each varEntry In Split(strPattern, "~")
                .filters.Add Split(varEntry, ",")(0), Split(varEntry, ",")(1)

            Next varEntry
        End If

What value of lngType are you passing???????

AGAIN! if you walked through the code, you would find that immediately :(

Plus you have commented out so much of the code that it is hard to see the wood for the trees??? :(
 

Gismo

Registered User.
Local time
Today, 10:18
Joined
Jun 12, 2017
Messages
1,075
OK, I have just created a macro to export to pdf and then converted it.
This is what I get?
Code:
    DoCmd.OpenReport "rptTestTransactions", acViewReport, "", "", acHidden
    DoCmd.OutputTo acOutputReport, "rptTestTransactions", "PDFFormat(*.pdf)", """c:\temp\gismomac.pdf""", False, "", 0, acExportQualityPrint
and that VBA works as well.

I have hardly ever used macros and have always used what is shown in those links I gave you ie acFormatPDF

I have no idea as to whether the multiple quotes are needed. In fact removing them to get
Code:
    DoCmd.OpenReport "rptTestTransactions", acViewReport, "", "", acHidden
    DoCmd.OutputTo acOutputReport, "rptTestTransactions", "PDFFormat(*.pdf)", "c:\temp\gismomac.pdf", False, "", 0, acExportQualityPrint
works just as well.
So I have no clue whatsoever as to why you cannot get it to work? :(
Thank you, seems to be working fine now

Private Sub DeferBtn_Click()
On Error GoTo DeferBtn_Click_Err

Dim StrFileName As String
Dim StrQryName As String
Dim StrSaveFile As String

DoCmd.SetWarnings False
'DoCmd.SelectObject acModule, "OpenOutlook", False
DoCmd.OpenQuery "Update Daw Status - Rectification", acViewNormal, acEdit
DoCmd.OpenQuery "Update Daw Status - Defer", acViewNormal, acEdit
DoCmd.OpenQuery "Update Defer with Reg", acViewNormal, acEdit

'StrFileName = ("Defer" & " - Registration -" & " " & Forms![Progress Check List - Defer]![Reg])
'StrFileName = strGetFileFolderName("Defer" & " - Registration -" & " " & Forms![Progress Check List - Defer]![Reg], 2, "PDF")


Debug.Print StrFileName
StrQryName = "Defer QRY"


If Len(StrFileName & "") < 1 Then
StrFileName = Application.CurrentProject.Path & "\Defer" & Format(Date, "yyyymmdd") & ".PDF"
End If

DoCmd.OutputTo acOutputReport, ("Defer" & " - Registration -" & " " & Forms![Progress Check List - Defer]![Reg]), "PDFFormat(*.pdf)", "", False, "", , acExportQualityPrint


'DoCmd.Close acForm, "Progress Check List - Defer"
'DoCmd.Close acForm, "Menu"
'DoCmd.OpenForm "Menu", acNormal, "", "", , acNormal
'DoCmd.SetWarnings True


DeferBtn_Click_Exit:
Exit Sub

DeferBtn_Click_Err:
MsgBox Error$
Resume DeferBtn_Click_Exit


End Sub

1634622357817.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 08:18
Joined
Sep 21, 2011
Messages
10,331
So what have you changed, and more importantly do you understand what you have changed?
 

Gismo

Registered User.
Local time
Today, 10:18
Joined
Jun 12, 2017
Messages
1,075
So what have you changed, and more importantly do you understand what you have changed?
I removed the StrFileName as it was not required and was causing errors
The code to save as was pretty simple actually.

It opens the file save as window
Auto populates the Report name and also includes some detail from the report such as the document number

DoCmd.OutputTo acOutputReport, ("Defer" & " - Registration -" & " " & Forms![Progress Check List - Defer]![Reg]), "PDFFormat(*.pdf)", "", False, "", , acExportQualityPrint

Thank you
 

Minty

AWF VIP
Local time
Today, 08:18
Joined
Jul 26, 2013
Messages
9,240
I think, if you look at your code you were missing a . before your PDF file name extension.
 

Gasman

Enthusiastic Amateur
Local time
Today, 08:18
Joined
Sep 21, 2011
Messages
10,331
Plus I cannot see how that code supplies a .pdf extension🙄
 

Users who are viewing this thread

Top Bottom