title: Choosing paper size (NOT DEFAULT sizes) in excel vba
body: <p>I have Brother QL-720NW Label Printer, which I want to print some labels on.</p>
  
  <p>The printer has a roll of width 62mm</p>
  
  <p>When I try to print something to it, I need to setup the page, and define page size.
  If the page size is incorrect (width more than 62mm) the printer won't print anything.</p>
  
  <p>Now my problem is that I am using excel with macros to send some data to the printer.
  I know there is some predefined page sizes (<a href="http://msdn.microsoft.com/en-us/library/office/ff834612%28v=office.15%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/office/ff834612%28v=office.15%29.aspx</a>) which can be used, but in my case all of them are too big for this purpose.</p>
  
  <p>Here a sample of the code I have so far:</p>
  
  <pre><code>Sub CreateTestCode()
  
  ' setting printer
  Dim objPrinter As String
  objPrinter = ActivePrinter
  ActiveSheet.PageSetup.PrintArea = Range("Img")
  With ActiveSheet.PageSetup
  .PrintTitleRows = ""
  .PrintTitleColumns = ""
  .PrintHeadings = False
  .PrintGridlines = False
  .RightMargin = Application.InchesToPoints(0.39)
  .LeftMargin = Application.InchesToPoints(0.39)
  .TopMargin = Application.InchesToPoints(0.39)
  .BottomMargin = Application.InchesToPoints(0.39)
  .PaperSize = xlPaperUser
  .Orientation = xlLandscape
  .Draft = False
  End With
  
  Dim printerName As String
  printerName = "BrotherQL720NW Labelprinter on XYZ"
  
  ActiveSheet.PrintOut Preview:=True, ActivePrinter:=printerName
  
  ActivePrinter = objPrinter
  End Sub
  </code></pre>
  
  <p>Now I have 3 questions:</p>
  
  <p>1: At the .PaperSize = xlPaperUser I get a runtime-error '1004'. Unable to set the PaperSize of the PageSetup class. What is wrong here ?</p>
  
  <p>2: How can I set the paper size to something like 62mm x 50mm ?</p>
  
  <p>3:  Even that I define the print area to Range("Img") it still print the whole sheet ?!?</p>
  
  <p>By the way I am totally new to vba, this is my first attempt to use vba.</p>