Date: Jan 28, 2013 11:23 AM
Author: Steven Lord
Subject: Re: msopen command using variable for file name

"Mark " <> wrote in message
> HI,
> I don't seem to be getting the syntax right for using the msopen function
> to have a Word file open. It works fine if I specifically define the
> filename, but I want to use a variable that I am creating.
> Here is the code:
> docfilename = char(strcat(fnpheader(7,2),fnpheader(7,3)));
> msopen docfilename;

Note this is equivalent to:

msopen('docfilename') % Open the file whose name is the string "docfilename"


msopen(docfilename) % Open the file whose name is contained in the variable
named docfilename

> An example of resulting docfilename is
> \\snr14\g1$\Calibration\PyranometerCalibrarion\Information\Instrument
> Calibration Analysis using MATLAB v1.docx
> This looks like it should work. I have tried
> msopen(docfilename); also.
> I get an error message that
> Cell contents reference from a non-cell array object.
> Error in msopen (line 31)
> file=files{i};
> Any ideas? THanks

Contact the author of the msopen file and ask for their help debugging and
fixing this problem?

Or, if you have Microsoft Office installed on your machine and associated
with the appropriate file extensions, just use the WINOPEN function.

Steve Lord
To contact Technical Support use the Contact Us link on