Need example: Add password to Excel file.

V

vbMark

Greetings,

I have an existing Excel file. I need to programatically password protect
the file so that it can't be read unless the password is entered.

Any code examples?

Thanks!

[c# 2005]


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Best free software
http://www.vbmark.com
Freeware-dedicated search engine
http://www.eurekster.com/parties/Freeware1.htm
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
N

Nicholas Paldino [.NET/C# MVP]

vbMark,

All you have to do is call the SaveAs method on the workbook. There is
a Password parameter that you set to the password you want to be used for
opening the workbook.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top