MS Access Automation

Hi , I am trying to create an automation with MS Access with PDFCreator to obtain high quality PDF.
I am trying to use the following VBA. I need create a pdf file with the following name "codigo.pdf"
without to name and save it manually.:

Private Sub Comando3_Click()
Dim pdfCreatorQueue As Object
Dim fullPath As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim codigo As String
DoCmd.SetWarnings False
' Abrir a base de dados atual
Set db = CurrentDb

' Execute the query to obtain the value of the 'codigo' field
Set rs = db.OpenRecordset("SELECT codigo FROM montagem_dados") ' Ajuste o nome da consulta e a cláusula WHERE conforme necessário

' Check if the query returned any results.
If Not rs.EOF Then
    codigo = rs.Fields("codigo").Value
Else
    MsgBox "No code found.", vbExclamation
    Exit Sub
End If

' Fechar o recordset
rs.Close
Set rs = Nothing

' Create the full path for the output file.
fullPath = "C:\catalogo\" & codigo & ".pdf"

' Create an instance of PDFCreator.
Set pdfCreatorQueue = CreateObject("PDFCreator.JobQueue")
pdfCreatorQueue.Initialize

' Definir o PDFCreator como impressora padrão
Application.Printer = Application.Printers("PDFCreator")

' Open the report in preview mode and print to PDFCreator.
DoCmd.OpenReport "cat_4_2_interno", acViewPreview, , , acHidden
DoCmd.PrintOut

' Wait for the job to complete.
If Not pdfCreatorQueue.WaitForJob(10) Then
    MsgBox "The PDFCreator job did not start in time.", vbExclamation
Else
    Dim printJob As Object
    Set printJob = pdfCreatorQueue.NextJob
    printJob.SetProfileByGuid ("HighQuality") ' Set to high quality.
    printJob.SetProfileSetting "Printing.PrinterName", "PDFCreator"
    printJob.SetProfileSetting "OutputFormat", "PDF"
    printJob.SetProfileSetting "OpenViewer", "false"
    printJob.ConvertTo fullPath

    ' Check if the conversion was successful.
    If (Not printJob.IsFinished Or Not printJob.IsSuccessful) Then
        MsgBox "There was an error during the file conversion.", vbExclamation
    End If
End If

' Terminate PDFCreator.
pdfCreatorQueue.ReleaseCom

End Sub

It is not working. I got error message that pdfcreator properties does not exist.
I have PDFCREATOR installed in my computer.

Anyone could give some directions please?
Regards

Roberto Reis .'.

Hi Roberto,

in the line

printJob.SetProfileByGuid ("HighQuality") ' Set to high quality.

change "HighQuality" to "HighQualityGuid".