Can't open an Xlsm file with Flexcel

Hi,

I can't open an Xlsm file with this code :
Any idea or suggestion. I can't find an example in the demo directory.
Thanks by advance.

Joel

uses Vcl.FlexCel.Core, FlexCel.XlsAdapter

var xls: TExcelfile;
      lOk: boolean;
      sFileName: string;
begin
sFileName : 'c:\test.xlsm';
Xls := TXlsFile.Create();
try
    try
        Xls.Protection.OpenPassword := 'test';
        Xls.Open(sFileName);
    except
        lOk := False;
    end;

    if lOk then
    begin
           // à faire

    end;
finally
  FreeAndNil(Xls);
end;

Hi,


I can't see anything wrong with the code except the fact that lOk is never initialized to true, so in case there is an error lOk will be undefined (and probably false).

But I assume this is just a bug created by isolating the code to paste it here. Are you sure the password is correct? I've made a little example with your code (adding a line lOk := true at the start) and it works fine. You can get the example here:

http://www.tmssoftware.biz/flexcel/samples/encrypted.zip

If this works with the included file but not with yours, can you send me the file with issues to adrian@tmssoftware.com ?  Maybe it is using some encryption not handled by FlexCel.

Hi,

The password was wrong, it is my error.
Thanks for your example.
Have a good night

Joel