How to open a password protected word document using Matlab?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
Would you please help me in writing a code in matlab to open a password protected word document?
below is the code I tried, but it does not work. please help me. Thank you.
[filename, pathname] = uigetfile('*.docx','Select a file','C:\');
filename = [filename,'.docx'];
password = 'secret';
passopen(filename,password);
function passopen(filename, password)
%Example filename = 'file.doc' and password = 'password'
Word = actxserver('Word.Application');
set(Word,'Visible',1);
[fpath,fname,fext] = fileparts(filename);
if isempty(fpath) out_path = pwd;
elseif fpath(1)=='.' out_path = [pwd filesep fpath];
else out_path = fpath;
end
try
Document=Word.Documents.Open([out_path filesep fname fext],0,0,0, password);
catch
error('Cannot open file and/or file does not exist!');
end
The output is : error??? Cannot open file and/or file does not exist! error in --> passopen(filename,password);
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Search Path についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!