title: Word automation - SaveAs
body: <p>I try to write a simple MFC - Word Automation to save for every 1 minute. 
  I follow this article : <a href="http://www.codeproject.com/KB/office/MSOfficeAuto.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/office/MSOfficeAuto.aspx</a></p>
  
  <p>And this is what Im trying to implement , I'm new to COM so I think there's problem here:
  my VBA is generated by Word 2010:</p>
  
  <pre><code>ActiveDocument.SaveAs2 FileName:="1.docx", FileFormat:=wdFormatXMLDocument _
      , LockComments:=False, Password:="", AddToRecentFiles:=True, _
      WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
       SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
      False, CompatibilityMode:=14
  </code></pre>
  
  <p>And my code to implement VBA code above : </p>
  
  <pre><code>{
      COleVariant varName(L"b.docx");
      COleVariant varFormat(L"wdFormatXMLDocument");
      COleVariant varLockCmt((BYTE)0);
      COleVariant varPass(L"");
      COleVariant varReadOnly((BYTE)0);
      COleVariant varEmbedFont((BYTE)0);
      COleVariant varSaveNativePicFormat((BYTE)0);
      COleVariant varForms((BYTE)0);
      COleVariant varAOCE((BYTE)0);
      VARIANT x;
      x.vt = VT_I4;
      x.lVal = 14;
      COleVariant varCompability(&amp;x);;
  
      VARIANT result;
      VariantInit(&amp;result);
      _hr=OLEMethod(  DISPATCH_METHOD, &amp;result, pDocApp, L"SaveAs2",10,
                      varName.Detach(),varFormat.Detach(),varLockCmt.Detach(),varPass.Detach(),varReadOnly.Detach(),
                      varEmbedFont.Detach(),varSaveNativePicFormat.Detach(),varForms.Detach(),varAOCE.Detach(),varCompability.Detach()
                   );
  }
  </code></pre>
  
  <p>I get no error from this one, but it doesn't work.</p>