Hy,
I have a macro that creates a new mail which works. Here is the macro.

Dim olApp      As Object
    Dim strAnrede  As String
    Dim strName    As String
    Dim strFntClr  As String
    Dim strFntNme  As String
    Dim strFntWht  As String
    Dim strFntSiz  As String
    Dim strFntStl  As String
    Dim strFntUdl  As String
    Dim sMyString1 As String     'T1
    Dim sMyString2 As String     'T2
    Dim sMyString3 As String     'T3
    Dim sMyString4 As String     'T4
    Dim sMyString5 As String     'T5
    Dim sMyString6 As String     'T6
    Dim sMyString7 As String     'T7
    Dim sMyString8 As String     'T8
    sMyString1 = ActiveDocument.Bookmarks("T1").Range.Text
    sMyString2 = ActiveDocument.Bookmarks("T2").Range.Text
    sMyString3 = ActiveDocument.Bookmarks("T3").Range.Text
    sMyString4 = ActiveDocument.Bookmarks("T4").Range.Text
    sMyString5 = ActiveDocument.Bookmarks("T5").Range.Text
    sMyString6 = ActiveDocument.Bookmarks("T6").Range.Text
    sMyString7 = ActiveDocument.Bookmarks("T7").Range.Text
    sMyString8 = ActiveDocument.Bookmarks("T8").Range.Text
           
        Set olApp = CreateObject("Outlook.Application")
            With olApp.CreateItem(0)
                .To = sMyString1
                .Subject = "text " & sMyString8
                .HTMLBody = sMyString7 & " " & sMyString4 & "<span style='color:" & strFntClr & "; " & _
                            "font-family:" & strFntNme & "; font-size:" & strFntSiz & _
                            "pt; font-weight:" & strFntWht & "; font-style:" & strFntStl & _
                            ",'>" & strName & "</span>,<br><br>" & _
                            "text " & sMyString8 & " zu senden." & "<br><br>" & _
                            "text" & "<br><br>" & _
                            "Kind Regards" & "<br><br>" & _
                            "Ttext" & "<br>"

                    .Display
                End With
            

End Sub

Public Function FarbeInHtml(ByVal lngRGB As Long) As String
FarbeInHtml = Right$("000000" & Hex$(lngRGB), 6)
FarbeInHtml = "#" & Right$(FarbeInHtml, 2) & Mid$(FarbeInHtml, 3, 2) & Left$(FarbeInHtml, 2)
End Function

The Word document has a macro that saves the .docm file as a .docx file. Here is the macro:


Dim firstName, lastName As String
firstName = ActiveDocument.Bookmarks("T7").Range.Text
lastName = ActiveDocument.Bookmarks("T8").Range.Text

Dim pfad As String
pfad = ActiveDocument.Path & Application.PathSeparator & "Data" & Application.PathSeparator

    ChangeFileOpenDirectory pfad
    ActiveDocument.SaveAs2 FileName:= _
        "firstName.docx", FileFormat:= _
        wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles _
        :=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts _
        :=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
        SaveAsAOCELetter:=False, CompatibilityMode:=15
End Sub
This works also fine.
Now I want to save the new .docx file as a PDF with the same name in the same folder as the .docx file and attach the PDF to the created mail.
I searched and tried a lot, but I had no luck.

Can you help me please?
Thanks a lot.
Kind Regards