Publishing to doc format fails with odd error

10 ビュー (過去 30 日間)
Kevin Galloway
Kevin Galloway 2023 年 9 月 7 日
コメント済み: Kevin Galloway 2023 年 9 月 8 日
I can successfully use the publish function if I set the output format to something like pdf or html, but if set the output format to doc I get an error that says Undefined function 'SaveAs' for input arguments of type 'Interface.0002096B_0000_0000_C000_000000000046'. I've observed this error on several different computers, all running MATLAB 2023a.
  4 件のコメント
Pooja Kumari
Pooja Kumari 2023 年 9 月 7 日
You can refer to the below documentation for more information on publish command on MATLAB R2023a:
Kevin Galloway
Kevin Galloway 2023 年 9 月 7 日
Thank you; I don't see anything about this error in the documentation.
As an update, if I try using publish from the command window, I get the following error message:
>> publish('test.m','doc');
Unrecognized function or variable 'SaveAs'.
Error in mxdom2word (line 119)
doc.SaveAs(outputPath,wdFormatDocument);
Error in publish
So seems to be a problem in the mxdom2word function.

サインインしてコメントする。

回答 (1 件)

Pooja Kumari
Pooja Kumari 2023 年 9 月 8 日
Dear Kevin,
I understand that you are encountering an "Undefined function 'SaveAs' for input arguments of type 'Interface.0002096B_0000_0000_C000_000000000046'" error when using the publish function in MATLAB with the output format set to "doc".
The publish command attempts to start up Word as a COM server to perform the operation. To verify if MATLAB is unable to start Word as a COM server, you can run the following command in the MATLAB prompt:
h = actxserver('Word.Application')
If there is an issue, an error message will be displayed.
Additionally, make sure you are running MATLAB as an administrator. Running MATLAB with administrative privileges can sometimes resolve issues related to starting Word as a COM server.
Another option you can try is starting Word as a COM server outside of MATLAB. You can use a VBA script to accomplish this. Running Word as a COM server separately will help determine if the issue lies with MATLAB or with Word itself.
You can refer to the below documentation for more information on publish command on MATLAB R2023a:
I hope this helps!
  1 件のコメント
Kevin Galloway
Kevin Galloway 2023 年 9 月 8 日
Hi Pooja,
Thanks for your suggestions on this. I tried running h = actxserver('Word.Application'), and the command ran successfully without error. However, if I try something like publish('test.m','doc'); as in the Mathworks documentation for the publish function (under "Generate View of MATLAB Script in Microsoft Word Format"), I get the failure with the error I stated above referring to the mxdom2word function. I'm not able to run with Administrator privileges since this is a work computer and I don't have that access, but I'll see if one of our IT support personnel can try that and see if it makes a difference.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by