Hi,

I have this code in outlook 365 to export to PDF attachments every time run it get run-time error 429 Activex component can't create object

and highlight this line:

Set DestinationPdf = CreateObject("AcroExch.PDDoc")

here is the complete code:

' Merge multiple PDF documents into a single PDF.
Private Sub MergePdfDocuments(PdfPath)
  'Set AcrobatApp = CreateObject("AcroExch.App")

  Set DestinationPdf = CreateObject("AcroExch.PDDoc")
  Set SourcePdf = CreateObject("AcroExch.PDDoc")

  ' Initialise the progress bar component.
  ' This resets the progress bar after converting documents to PDF.
  ProgressForm.Increment 0, "Merging..."
  Counter = 0

  ' We will merge PDFs into the first PDF.
  DestinationPdfPath = FilesToMerge.Item(1)
  DestinationPdf.Open DestinationPdfPath
  FilesToMerge.Remove (1)

  ' Iterate through the emails and attachments that were saved to the file system.
  For Each FileToMerge In FilesToMerge
    ProgressForm.Increment (Counter / FilesToMerge.count) * 100, "Merging..."
    Sleep 250

    ' Open the source PDF.
    SourcePdf.Open FileToMerge

    ' The page number within the destination PDF where content will be inserted.
    LastPage = DestinationPdf.GetNumPages - 1

    ' The number of pages to insert.
    NumberOfPagesToInsert = SourcePdf.GetNumPages

    ' Insert the content into the destination PDF.
    DestinationPdf.InsertPages LastPage, SourcePdf, 0, NumberOfPagesToInsert, False

    ' Close and then delete the source PDF.
    SourcePdf.Close
    Kill FileToMerge

    Counter = Counter + 1
  Next FileToMerge

  ' Save the merged PDF and delete the original.
  DestinationPdf.Save 1, PdfPath
  Kill DestinationPdfPath

  ' Close the PDF document.
  DestinationPdf.Close
End Sub
thank you