title: DDE SAS to run VBA code
body: <p>I can't get Excel 2010 to execute a macro from SAS. I'm exporting data from some SAS tables to Excel, which works fine, and when I run the VBA macro manually it also does what it should, but it just won't execute automatically. The Excel file is called "FIH.xls" and the macro is called "Opryd" as Module1. The SAS Log doesn't come up with any errors, neither does Excel. I've allowed all macros to run in the Excel settings. Still it doesn't execute.  </p>
  
  <pre><code>options noxwait noxsync;
  x '"C:\FIH.xls"';
  /* Putting SAS in sleep mode to give Excel the necessary time to open the file */
  data _null_; x=sleep(5);
  run;
  
  FILENAME excel DDE 'EXCEL|Grp!r5c8:r7c20' notab;
      DATA _NULL_;
     SET gem.rap_konc_selskab;
      FILE excel;
      PUT '09'x selskab_rap '09'x gr_vis_start '09'x man_amt '09'x '09'x '09'x rest_2 '09'x ;
      RUN;
  data _null_;
  file excel;
  put '[run ("FIH.xls!Opryd")]';
  run;
  </code></pre>