Method 'ExportAsFixedFormat' of object '_worksheet' failed
<p>Here are my code to export all sheets of excel to PDF:</p>

<pre><code>Sub printing()

Dim i As Integer, wkb As String, head As String, nm As String
Dim ws As Worksheet

Application.ScreenUpdating = False

'get folder path
wkb = InputBox("Enter folder path:", , ActiveWorkbook.Path)
If Right(wkb, 1) &lt;&gt; Application.PathSeparator Then wkb = wkb &amp; Application.PathSeparator

'head of file name
head = InputBox("Enter head of file name", , "Test")

Application.DisplayAlerts = False
For Each ws In ActiveWorkbook.Worksheets
'ActiveWorkbook.Sheets.Count

    If ws.Visible = True Then
        ws.Select
        nm = ws.Range("A1")
        If nm &lt;&gt; "" Then
            'save
            ActiveSheet.ExportAsFixedFormat _
                Type:=xlTypePDF, _
                FileName:=wkb &amp; head &amp; nm &amp; ".pdf", _
                Quality:=xlQualityStandard, _
                IncludeDocProperties:=True, _
                IgnorePrintAreas:=False, _
                OpenAfterPublish:=False
        End If

        Application.DisplayAlerts = False
    End If
Next

Application.DisplayAlerts = True
Application.ScreenUpdating = True

MsgBox "Done"

End Sub
</code></pre>

<p>I run this macro on my Mac and my friend's Mac, But my Mac is pass,and my friend's mac not pass and occured an errors:</p>

<blockquote>
  <p>Run time error '1004': </p>
  
  <p>Method 'ExportAsFixedFormat' of object '_worksheet' failed</p>
</blockquote>

<p>Can you tell me a solution to fix it?</p>

<p>Thanks.</p>