title: excel to pdf ignores print area and calls printer
body: <p>This loops through a list of students, but fails on the print area, which is set and coded in the export line - it prints 130 pages for each student when it should only be one. All the printer gets called which opens a dialogue box (login 6 password) and that stops the macro - the printer is a workprinter on a network which is not always available.
  Is there a way to stop the printer getting called?
  And controlling the pages to the print area?</p>
  
  <pre><code>Option Explicit
  
  Sub PdfExportMacro()
  Dim rCell As Range, rRng As Range
  
  'Student numbers in cells A7:A160
  Set rRng = Worksheets("studentlist").Range("A7:A160") '&lt;--| set your "students" range
  
  With Worksheets("Feedback") '&lt;--| reference "Feedback" worksheet
      For Each rCell In rRng '&lt;--| loop through "students" range
      .Range("A1").Value = rCell.Value '&lt;--| write current student number to cell A1 on Feedback sheet
  
         ' Export &amp; save file as pdf using SNum as filename:
          .ExportAsFixedFormat Type:=xlTypePDF, fileName:= _
          "Macintosh HD:Users:Michael:Desktop:" &amp; rCell.Value, Quality:= _
          xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
          OpenAfterPublish:=False
      Next rCell
  End With
  
  End Sub
  </code></pre>