OLE and Word 2010

Started by troya2od, July 02, 2013, 07:34:55 AM

Previous topic - Next topic

troya2od

I have a few thousand files that I need to convert from .doc to .docx and to .txt.

When using objDoc.SaveAs(ProcessedFile) with the file extension  .txt the file is saved with the .txt extension but is still in the .doc format. The .docx output extension throws a 1261: Ole: Exception.

Obviously I am missing a file format parameter. Can someone point me to the file format values and usage syntax?

TIA
Troy

Deana

The Word SaveAs method has a number of optional parameters. One being the FileFormat parameter: http://msdn.microsoft.com/en-us/library/office/bb221597(v=office.12).aspx, the value specific should be one of the wdSaveFormat constants, defined here: http://msdn.microsoft.com/en-us/library/office/bb238158(v=office.12).aspx. In your case the value2 for wdFormatText (Microsoft Windows text format).

Reference: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~with~Word+Word~SaveAs~HTML.txt
Deana F.
Technical Support
Wilson WindowWare Inc.