none
VBA For MAC - Export as PDF not working RRS feed

  • Question

  •  The code below works fine with Windows but When I use on the MAC it send the file to the printer instead of saving it as pdf file.

    Thank you for your help.

    Sub ExportOneToPDF()
    '
    '   This Macro exports the active worksheet into PDF format

        Application.ScreenUpdating = False

        Dim RootDirec As String
        Dim File As String
        Dim ShName As String
        
    '    RootDirec = "C:\Users\Victor Gameiro\Dropbox\AT — Macela\Restaurante\FICHAS TÉCNICAS\Formato PDF\"     '  For Windows
    '    RootDirec = "/Users/Victor Gameiro/Dropbox/AT — Macela/Restaurante/FICHAS TÉCNICAS/Formato PDF/"       ' For Mac
        
           RootDirec = "/MacIntosh HD/Desktop/"              ' For Mac
          
            ShName = ActiveSheet.Name
            If ShName = "INDEX" Or ShName = "INGREDIENTES" Or ShName = "medidas" _
                    Or ShName = "Receita 1" Or ShName = "Preparacao 1" Then
                MsgBox ("This macro only prints Worksheets with Recipes")
                GoTo Line1
            End If
            File = RootDirec & ShName & ".pdf"
            Debug.Print File
            
            ActiveSheet.PageSetUp.PrintArea = "A1:J69"
            ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=File, Quality:= _
                xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
                OpenAfterPublish:=False

            Application.ScreenUpdating = True
    Line1:
    End Sub

    Monday, December 17, 2018 1:19 AM

All replies