From: Justin on 21 Jul 2010 15:36 Hello, I have an issue pertaining to opening Excel password protected files via Matlab. I was wondering if there is a way to pass the password when opening a password protected excel file in Matalb? Any help with this would be greatly appreciated. Thanks, Justin
From: Andy on 21 Jul 2010 15:48 "Justin " <rothj070(a)gmail.com> wrote in message <i27i82$3fa$1(a)fred.mathworks.com>... > Hello, > > I have an issue pertaining to opening Excel password protected files via Matlab. I was wondering if there is a way to pass the password when opening a password protected excel file in Matalb? Any help with this would be greatly appreciated. > > Thanks, > Justin doc actxserver The Open method of the Workbooks object takes a password as an argument. So something close to the following should work: [fn pn] = uigetfile('*.xls'); passwd = 'yourpassword'; % don't actually store your password in the mfile like this e=actxserver('excel.application'); eW = e.Workbooks; eF = eW.Open([pn fn],passwd); Note: this is untested, as I am currently away from MATLAB.
From: Justin on 22 Jul 2010 08:21 "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i27itk$ghg$1(a)fred.mathworks.com>... > "Justin " <rothj070(a)gmail.com> wrote in message <i27i82$3fa$1(a)fred.mathworks.com>... > > Hello, > > > > I have an issue pertaining to opening Excel password protected files via Matlab. I was wondering if there is a way to pass the password when opening a password protected excel file in Matalb? Any help with this would be greatly appreciated. > > > > Thanks, > > Justin > > doc actxserver > > The Open method of the Workbooks object takes a password as an argument. So something close to the following should work: > > [fn pn] = uigetfile('*.xls'); > passwd = 'yourpassword'; % don't actually store your password in the mfile like this > e=actxserver('excel.application'); > eW = e.Workbooks; > eF = eW.Open([pn fn],passwd); > > Note: this is untested, as I am currently away from MATLAB. I ran the code and I get the following error: ??? Invoke Error, Dispatch Exception: Source: Microsoft Office Excel Description: Open method of Workbooks class failed Help File: C:\Program Files\Microsoft Office\Office12\1033\XLMAIN11.CHM Help Context ID: 0 Error in ==> testpwdprotect at 5 eF = eW.Open([fn pn],passwd); Essentially I would like to be able to open this workbook, which is stored on a server, without prompting the user and then use xlswrite to write to and save the workbook.
From: Andy on 22 Jul 2010 08:37 > Error in ==> testpwdprotect at 5 > eF = eW.Open([fn pn],passwd); Note the order of the path name and file name.
From: Andy on 22 Jul 2010 08:55 "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i29e1j$6ti$1(a)fred.mathworks.com>... > > Error in ==> testpwdprotect at 5 > > eF = eW.Open([fn pn],passwd); > > Note the order of the path name and file name. Alright, I finally had a chance to try it out. The following worked for me: eF=eW.Open([pn fn],[],false,[],'pass'); Note: I typed the password into a string. But it's generally not the best idea to have your passwords hard coded into an m-file.
|
Next
|
Last
Pages: 1 2 Prev: relational operator tolerences Next: How to align two time series fast? |