0

Having an issue and getting the compile error syntax error. I've gone through and can't find where the wrong spacing is.

Can someone see my mistake?

Sub Save()
' Save Macro
' Save PDF
'

'
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "S:\ACCESS INDUSTRIES HUB\OPERATIONS\JARED PO BOOK\PO.Range("C4").Value = Range("C4").Value.pdf", Quality:= _
        xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
        OpenAfterPublish:=True

Screenshot of excel

1 Answer 1

2

I do not believe the method you have used to name the file will work, you need something like:

Dim MyDir As String
MyDir = "S:\ACCESS INDUSTRIES HUB\OPERATIONS\JARED PO BOOK\"

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
MyDir & Range("C4").Value & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True
2
  • Thanks for your suggestion... i've tried a couple ways for naming.. i did it your way and still have the Syntax error
    – Jared
    Apr 23, 2020 at 2:39
  • You are not separating your strings from the variable, you need to complete the string for the path within the quote marks, then concatenate with the C4 value using & then concatenate with the .pdf. within quotes --> "S:\ACCESS INDUSTRIES HUB\OPERATIONS\JARED PO BOOK\" & Range("C4").Value & ".pdf" Apr 23, 2020 at 9:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .