By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,973 Members | 1,854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,973 IT Pros & Developers. It's quick & easy.

Opening password protected Excel files using VB.net

P: n/a
I am writing a small program that needs to be able to open Excel
workbooks which are password protected. Does anyone know how to do this,
without any interaction from the user? I am sure it is something simple that
I am missing.

Here is the relevant section of my code:

ExcelApp = CType(CreateObject("Excel.Application"),
Excel.Application)

ExcelBook = ExcelApp.Workbooks.Open(File)

ExcelBook.Password = "aaaaaa"



ExcelSheet = ExcelBook.Worksheets("Sheet Sorted by Section Number")

ExcelApp.Visible = True

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
* <Robert Sanderson> scripsit:
I am writing a small program that needs to be able to open Excel
workbooks which are password protected. Does anyone know how to do this,
without any interaction from the user? I am sure it is something simple that
I am missing.


You may want to ask this question here:
microsoft.public.excel.programming.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

P: n/a
> I am writing a small program that needs to be able to open
Excel
workbooks which are password protected. Does anyone know how to do this,
without any interaction from the user? I am sure it is something simple that I am missing.


..Open method has many parameters, one of them is Password.

Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword,
IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter,
AddToMru, Local, CorruptLoad, OpenConflictDocument)

Read
http://msdn.microsoft.com/library/de.../xlmthOpen.asp
in MSDN, it should help you.

sincerely,
--
Sebastian Zaklada
Skilled Software
http://www.skilledsoftware.com
************************************
SQL Source Control 2003 - for
SQL Server Source Safe integration
and custom databases documentation
Nov 20 '05 #3

P: n/a


"Blumidoo" <no****@nottelling.com> wrote in message
news:bs**********@atlantis.news.tpi.pl...
I am writing a small program that needs to be able to open Excel
workbooks which are password protected. Does anyone know how to do this,
without any interaction from the user? I am sure it is something simple

that
I am missing.


.Open method has many parameters, one of them is Password.

Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword,
IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter,
AddToMru, Local, CorruptLoad, OpenConflictDocument)

Read

http://msdn.microsoft.com/library/de.../xlmthOpen.asp in MSDN, it should help you.

sincerely,
--
Sebastian Zaklada
Skilled Software

Thanks.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.