Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to export data to excel wiht password?

Status
Not open for further replies.

n1br

Programmer
Apr 7, 2004
3
0
0
BR
Please,

If anyone knows how to export data to excel with password in Delphi 7, I would thank a lot.

I tried this code but I have no tutorial to know if there
is a parameter to protect the excel file. In case it's possible to export with password, how I would import protected files?


Thanks.


msexcel:=CreateOleObject('excel.application');
excelbook:=msexcel.workbooks.add;
msexcel.ActiveWorkbook.Names.Add('test', '=Sheet1!$A$1:$D$3', EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam);
 
Here is how I open a password protected execl file:

ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks.Open(MyPath + MyFile, EmptyParam, EmptyParam,
EmptyParam, MyPassword, EmptyParam,
EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam,
EmptyParam, LCID));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top