Hello,
I have found this code on the web but still can't seem to find a solution to this,
I want to create a pdf file with the filepath based on userform captions or sheets values like you can seen bellow but i can't seem to make it work and i don't know what i'm doing wrong.

Dim FileAndLocation As Variant
Dim strPathLocation As String
Dim strFilename As String
Dim strPathFile As String

strPathLocation = ThisWorkbook.Path & "\" & marquetxtbox.Value & "-" & repnump.Caption & "-" & nomprenom.Caption & "-" & typemachinerep.Caption
strFilename = repnump.Caption
strPathFile = strPathLocation & strFilename

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
strPathLocation & strFilename & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False