Error in publishing

조회 수: 2 (최근 30일)
Gurudatha Pai
Gurudatha Pai 2011년 10월 25일
I use Matlab 7.12.0 R2011a, on a Windows XP SP3 box. I am trying to use the publish feature of Matlab to automatically create a Microsoft Office Word file with the results that I am dumping on the Matlab Command Window and other figures. I get the following error message.
??? Error using ==> saveas at 72
Invalid Simulink object specifier
Error in ==> mxdom2word at 149 doc.SaveAs(outputPath,wdFormatDocument);
Error in ==> publish at 183 mxdom2word(dom,outputAbsoluteFilename);
Error in ==> mdbpublish at 55 outputPath = publish(file, options);
??? Error using ==> open at 69 NAME must contain a single string.
The #69 of
open()
gets a empty string and hence the error. But when I looked closer into the code for
publish.m
and then into
mxdom2word.m
It seems to me that the culprit is the line #149 (in my file, I presume it will be same on yours too), specifically the line below
doc.SaveAs(outputPath,wdFormatDocument);
If I set a debug point at this line and look into the
doc
object (of type Interface.Microsoft_Word_14.0_Object_Library._Document), it does not have a
doc.SaveAs()
method. Seems to me like the run-time is somehow calling the default
SaveAs()
subroutine. I changed the code to
doc.SaveAs2()
and the whole thing runs fine.
Your comments, suggestions? Could you please tell me if my diagnosis is right? Is this behavior to be thought as a bug? or a programmer's mistake!
P.S: I use MS Office 2010
  댓글 수: 1
Christie Dennis
Christie Dennis 2012년 1월 6일
I get the same error when I try to publish to Word. Did you ever get a response to this bug?

댓글을 달려면 로그인하십시오.

채택된 답변

Ken Atwell
Ken Atwell 2012년 1월 6일
Gurudatha, SaveAs works with earlier versions of Office, but Office 2010 needs "SaveAs2", as you have discovered. :) R2011b addresses this.
  댓글 수: 1
Gurudatha Pai
Gurudatha Pai 2012년 1월 6일
Thanks, that was good know.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scripts에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by