PolarSpartan
New Member
I'm trying to save a file as a pdf using a file name and folder location that is dependent on variables in the worksheet. Here's the macro:
'Assign variable name for the file name
FN = Sheet6.Range("N10").Value
'Save to PDF
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=FN, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End Sub
If the file is saved at the root directory level, this works fine. If I replace the FN variable with a file location, the macro will save in the right directory, but when I use the variable to save to a folder location other than a root directory, I get an error (1004).
Any ideas how to get the variable name to work?
'Assign variable name for the file name
FN = Sheet6.Range("N10").Value
'Save to PDF
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=FN, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End Sub
If the file is saved at the root directory level, this works fine. If I replace the FN variable with a file location, the macro will save in the right directory, but when I use the variable to save to a folder location other than a root directory, I get an error (1004).
Any ideas how to get the variable name to work?