• I can’t change the PDF name using VBA

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » I can’t change the PDF name using VBA

    Author
    Topic
    #1772396

    Hello,

    I’m trying to send a sheet in excel as pdf in outlook. I would love to know how i can change the pdf attached name that gets sent in outlook from excel using vba.

    This is part of the code:

    Code:
    strPath = Environ$(“temp”) & “”
      
        strFName = Replace(ActiveWorkbook.Name, “.pdf”, “”)
        strFName = Left(strFName, InStrRev(strFName, “.”) – 1) & ” _ ” & ws3.Range(“E10″).Value _
        & ” _ ” & Format(Now, “dd-mmm-yy”) & “.pdf”
       
        ws3.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
            strPath & strFName, Quality:=xlQualityStandard, _
            IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
    

    i tried to change ActiveWorkbook.Name but it gives me an error. Can someone please help?

    Thank you.

    Reply To: I can’t change the PDF name using VBA

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: