Hi, I'm using actxserver('Word.Application') to copy data from Matlab to a Word template. And I'm having problems with the navigation in the document.
%Initialization
word=actxserver('Word.Application');document=word.Documents.Open([pwd '\Report_Generation\name_of_report.docx']);word.Visible=1;selection=word.Selection;
If I write
selection.MoveDown
or
invoke(selection,'MoveDown');
Then it's working, the selection moves down a line in the Word doc.
But if I would like the selection to move down paragraphs (or headings), not lines, and I set the arguments to wdParagraph I get an error. (even if i set the unit to wdLine, which is the default value).
>> selection.MoveDown(wdParagraph)Undefined function or variable 'wdParagraph'.>> selection.MoveDown(Microsoft.Office.Interop.Word.WdUnits.wdParagraph, 1, Microsoft.Office.Interop.Word.WdMovementType.wdMove)Undefined variable "Microsoft" or function "Microsoft.Office.Interop.Word.WdUnits.wdParagraph".>> invoke(selection,'MoveDown',wdParagraph);Undefined function or variable 'wdParagraph'.
Do You know how to set properly the arguments of these methods?
Best Answer