Excel sheet to PDF Mac Office 2106 (Ver 16:19) Excel on Mac

Dudley James
Occasional Visitor

Hello All

Firstly I hope that this is the correct forum for this post please forgive if not;

I'm still struggling with ExportAsFixedFormat I have read Ron de Bruin excellent macro but its not working for me.

I need to understand the fundamentals of the command, is it a Mac problem? I understand it works in a windows environment 


I have tried the follow code which takes path and file name to make a PDF with the results below:-


Sub save_bas()

Dim Fname As String
Dim Fpath As String

Fname = "Inv_test.pdf"
Fpath = "/users/username/documents/lux/accounts/accounts_15/"

If Dir(Fpath) = "" Then
    MsgBox "Directory does not exist..."
End If

MsgBox (Fpath & Fname)

If ActiveWorkbook.Saved = False Then ActiveWorkbook.Save

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=Fpath & Fname

End Sub



The above code generates an message "Error while Printing" and a debug window with an error code 1004.


If I slightly modify the code and change the filename to "test" for example then a file called test.pdf can be found at




The Directory check on first run triggered a permission box which I allowed excel to access the directory as per "Fpath"


So in summary ExportAsFixedFormat is working but not when I try to store the file in the directory I stipulate and or the file name


Any ideas


Many thank in advance