word SaveAs 0x800a1421

环境:xp,vs2003,word 2007

问题:使用vc+vba编程,执行word另存为操作,

m_pDjcxView->m_lpWord->SaveAs(&FileName,&FileFormat,&LockComments,&Password,
            &AddToRecentFiles,&WritePassword,&ReadOnlyRecommended,
            &EmbedTrueTypeFonts,&SaveNativePictureFormat,&SaveFormsData,
            &SaveAsAOCELetter);

结果有的电脑是好的,有的电脑报错,异常代码0x800a1421,google,

解决:

'8' stands for failure

'0xa' points me to facility 'Control'(#define FACILITY_CONTROL         10,)

‘0x1421’转成十进制5153,网上说继续google word error 5153

原因:

You are trying to overwrite a file that somebody else has opened.

即:试图重写已经打开的文件(汗,c语言的文件被使用中?)

解决:

it can't be overwritten because

it is open for editing. You must either:

1. Give your file a different name.

2. Change the company name.

3. Cancel this macro.
于是选择1,重命名后再保存

参考:

http://stackoverflow.com/questions/16187246/what-is-the-meaning-of-0x800a1421-hresult

http://www.tech-archive.net/Archive/Word/microsoft.public.word.vba.beginners/2005-04/msg00105.html

你可能感兴趣的:(word SaveAs 0x800a1421)