title: Object doesn't support property or method 'ExecWB' when trying to call a print preview dialog in IE9
body: <p>I am writing a web application for IE9 and I need to open the Print Preview dialog (not the window.print(), but the one where they can set the margins etc.)</p>
  
  <p>I found this code in this question - <a href="https://stackoverflow.com/questions/25564907/open-another-page-or-image-in-print-preview">Open another page or image in print Preview</a>: </p>
  
  <pre><code>function PrintPreview()
  {
    var OLECMDID =  7;
  
    /* OLECMDID values:
    * 6 - print
    * 7 - print preview
    * 0 - open window
    * 4 - Save As
    */
  
    var PROMPT = 1; // 1 PROMPT USER 2 DON'T PROMPT USER
    var WebBrowser = '&lt;OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"&gt;&lt;/OBJECT&gt;';
  
  
    window.document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
  
    WebBrowser1.ExecWB(OLECMDID, PROMPT);
    WebBrowser1.outerHTML = "";
  
  } 
  </code></pre>
  
  <p>However, this line fails: </p>
  
  <p><code>WebBrowser1.ExecWB(OLECMDID, PROMPT);</code></p>
  
  <p>The error message in both IE9 and IE11 is this: </p>
  
  <blockquote>
    <p>"Object doesn't support property or method 'ExecWB'" </p>
  </blockquote>
  
  <p>Update: more testing showed that the code works in some IE9/IE11 browsers (such as on my machine) but doesn't work on the browser inside an Azure VM and on my customer's configuration. </p>
  
  <p>WebBrowser1 is not null and has a lot of properties and methods, such as the correct <code>classid</code>, but doesn't have the <code>ExecWB()</code> method.</p>