Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
David[_5_] David[_5_] is offline
external usenet poster
 
Posts: 2
Default Save as docx from Word 2007

I'm attempting to open a .doc file in a C++ Word 2007 automation
program and save it as docx, but the resulting document is always in
compatibility mode. Here's the relevant code:

short wdFormatXMLDocument = 12;
COleVariant vXMLFormat(wdFormatXMLDocument, VT_I2);
CString sName = m_pDocument-get_FullName();
CString sTempName = sName + _T("x");
CComVariant vName(sName);
CComVariant vTempName(sTempName);
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
m_pDocument-SaveAs(&vTempName, &vXMLFormat, &covOptional,
&covOptional, &covOptional, &covOptional, &covOptional, &covOptional,
&covOptional, &covOptional, &covOptional, &covOptional, &covOptional,
&covOptional, &covOptional, &covOptional);
m_pDocument-Close(&viDoNotSave, &vOriginalFormat, &vbFalse);
m_pDocument = NULL;
closeDoc(false);

Instead of wdFormatXMLDocument I've also tried long
wdFormatDocumentDefault = 16, with the same result.

Can anyone tell me what I'm doing wrong?

Thanks,
David

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
David[_5_] David[_5_] is offline
external usenet poster
 
Posts: 2
Default Save as docx from Word 2007

For anyone who may be reading this and having the same problem, the
solution is to call the Convert() method of the document class before
calling SaveAs.
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mailmerge from Access 2007 to Word 2007 .docx document Russell Profitt[_3_] Mailmerge 0 March 20th 08 12:16 PM
Word 2003 for doc files and 2007 for docx? Mike[_11_] Microsoft Word Help 0 February 1st 08 06:35 PM
Cannot save a Word 2003 Doc to Word 2007 docx full mode Alex Zimmerhaven Microsoft Word Help 0 November 29th 07 10:09 PM
2007 to 2003 converter (docx-doc) "CONVERTER FAILED TO SAVE THE FI Professor M Microsoft Word Help 2 September 6th 07 06:14 PM
2007 Default Doc save is DOCX how to make DOC? Ron Boetger New Users 10 October 20th 06 06:09 PM


All times are GMT +1. The time now is 01:42 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"