How to open a password protected word document using Matlab?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Whos dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!