Unprotect excel file from matlab
Ältere Kommentare anzeigen
Hi, I am using the ProtecStatus2 file from the File Exchange to open a protected excel file. It doesn't work.
Excel = actxserver('Excel.Application');
Excel.visible = 1;
Woorkbooks = get( Excel, 'Workbooks' );
invoke(Woorkbooks, 'open', [pwd 'Book1.xlsx']);
ProtecStatus2(Excel, 'DONOTBREAK');
Error using
Interface.Microsoft_Excel_15.0_Object_Library.Workbooks/invoke
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: Sorry, we couldn't find C:\Users\Cedric\Desktop\Learning
GUIBook1.xlsx. Is it possible it was moved, renamed or deleted?
Help File: xlmain11.chm
Help Context ID: 0
Error in PassUnprotect (line 4)
invoke(Woorkbooks, 'open', [pwd 'Book1.xlsx']);
I also tried using the xlsprotect function from the File Exchange, But, it also doesn't work even after I use xlsread.
xlsprotect('Book1.xls','unprotect_file','DONOTBREAK');
[NUM,TXT,RAW]=xlsread('Book1.xls');
Error using
Interface.Microsoft_Excel_15.0_Object_Library.Workbooks/invoke
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: Sorry, we couldn't find C:\Users\Cedric\Desktop\Learning
GUI\Book1.xls. Is it possible it was moved, renamed or deleted?
Help File: xlmain11.chm
Help Context ID: 0
Error in xlsxprotect (line 120)
Workbook =
invoke(Excel.Workbooks,'open',file,0,0,1,varargin{1});
Error in PassUnprotect (line 3)
xlsprotect('Book1.xls','unprotect_file','DONOTBREAK');
What is going on here?
It has been a month that I've tried to figure this out, and I am really depressed.
Please help me, I need anyone's help.
I am getting nuts about this.
5 Kommentare
Ahmed A. Selman
am 16 Apr. 2013
A common thing is that the file directory is not included in your Matlab path, or you've missed a letter (usually a blank space) in its name or path.
MatlabFan
am 16 Apr. 2013
Image Analyst
am 17 Apr. 2013
I supposed this program takes a password and removes the password from a password-protected workbook so that it's no longer password protected. What did the original author say when you contacted him?
Ahmed A. Selman
am 18 Apr. 2013
What version of Windows (or any other OS) you're using? Perhaps removing the directory entirely to another (safer) place, say, D:\, might solve the issue. I think it's all about permission to change contents of some file in a Windows protected directory (\Users, in this case), and it's a common behavior of Windows 7.
Besides, you've used (book1.xls) and (Book1.xlsx) in the question above. I think you recognize that filename extension .xls is (excel 2003 down), and .xlsx is (excel 2007 up).
MatlabFan
am 18 Apr. 2013
Antworten (1)
Hi,
the error you get:
Sorry, we couldn't find C:\Users\Cedric\Desktop\Learning
GUIBook1.xlsx
suggests a missing \ after GUI, doesnt it? Generating a path with [pwd 'Book1.xlsx'] is always a bad idea. Better is to use
fullfile(pwd,'Book1.xlsx')
When you did xlsread the path seems to be correct:
xlsread('Book1.xls');
Sorry, we couldn't find C:\Users\Cedric\Desktop\Learning
GUI\Book1.xls
However there is an x missing at the end, doesnt it? Book1.xlsX <=
1 Kommentar
MatlabFan
am 17 Apr. 2013
Kategorien
Mehr zu Spreadsheets finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!