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

Open password protected Excel workbook in Visual Basic

P: n/a
Hello,

My VB 6.0 application read and writes data from and to a MS Excel workbook,
using the Microsoft.Jet.OLEDB.4.0 provider.

Now I want to protect the Excel workbook with a password, but I figured out
that it is not possible to open the workbook for data access with ADO
(http://support.microsoft.com/?KBID=211378).

Is there another way to use a password protected Excel workbook in my
application?

Regards,

Geert-Pieter
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
If you know the password, you should be able to use it via the the MS Excel
Object Model.

Here's a link to the 2000 documentation
http://msdn.microsoft.com/library/en...tmodelguide.as
p?frame=true
http://msdn.microsoft.com/library/de...us/odeomg/html
/deovrmicrosoftexcel2000.asp

Good luck,
--
John MacIntyre
VC++ / VB / ASP / Database Developer
http://www.johnmacintyre.ca
"Geert-Pieter Hof" <g.*******@wbmt.tudelft.nl.blablabla> wrote in message
news:bj**********@azure.qinip.net...
Hello,

My VB 6.0 application read and writes data from and to a MS Excel workbook, using the Microsoft.Jet.OLEDB.4.0 provider.

Now I want to protect the Excel workbook with a password, but I figured out that it is not possible to open the workbook for data access with ADO
(http://support.microsoft.com/?KBID=211378).

Is there another way to use a password protected Excel workbook in my
application?

Regards,

Geert-Pieter

Jul 17 '05 #2

P: n/a
According to MS Knowledge Base Article 249843, the MS Excel Object library
is not redistributable. So I cannot the mentioned solution on computers that
haven't got MS Excel installed.

So, is there another way to read data from password protected Excel
workbooks?

Best regards,

Geert-Pieter

"John MacIntyre" <Pl****@reply.to.group.thx> schreef in bericht
news:wh*******************@news20.bellglobal.com.. .
If you know the password, you should be able to use it via the the MS Excel Object Model.

"Geert-Pieter Hof" <g.*******@wbmt.tudelft.nl.blablabla> wrote in message
news:bj**********@azure.qinip.net...
Hello,

My VB 6.0 application read and writes data from and to a MS Excel workbook, using the Microsoft.Jet.OLEDB.4.0 provider.

Now I want to protect the Excel workbook with a password, but I figured out that it is not possible to open the workbook for data access with ADO
(http://support.microsoft.com/?KBID=211378).

Is there another way to use a password protected Excel workbook in my
application?

Regards,

Geert-Pieter

Jul 17 '05 #3

P: n/a
"Geert-Pieter Hof" <g.*******@wbmt.tudelft.nl.blablabla> wrote in message
news:bj**********@azure.qinip.net...
According to MS Knowledge Base Article 249843, the MS Excel Object library
is not redistributable. So I cannot the mentioned solution on computers that haven't got MS Excel installed.

So, is there another way to read data from password protected Excel
workbooks?

Best regards,

Geert-Pieter


Hi Geert-Pieter,

I assumed the user would have Excel.

There is also a ODBC driver available. This has never really appealed to me
since Excel does not have a rigid table structure, so I've always gone
through the Object Model.

Also, you better check the dependencies ... who knows if the user needs to
have XL on their PC for the ODBC drivers to work.

Do you mind if I ask why you are using an Excel file? I am assuming, from
comments in this thread, the XL file is yours as part of your distributable.

Regards,
John MacIntyre
VC++ / VB / ASP / Database Developer
http://www.johnmacintyre.ca
Jul 17 '05 #4

P: n/a
> There is also a ODBC driver available. This has never really appealed to
me
since Excel does not have a rigid table structure, so I've always gone
through the Object Model.
Now I'm becoming a bit confused: MS Knowledge Base Article 211378 states
that opening an password protected Excel workbook is not possible when using
the MS Excel ODBC driver, so the above suggestion won't work.

However, I am using the MS Jet OLE DB driver and I also can't open a
password protected Excel workbook, although this problem isn't mentioned in
MS Knowledge Base Article 211378. The MS Excel ODBC driver and the MS Jet
OLE DB driver are two different drivers, don't you think?
Also, you better check the dependencies ... who knows if the user needs to
have XL on their PC for the ODBC drivers to work.

Do you mind if I ask why you are using an Excel file? I am assuming, from
comments in this thread, the XL file is yours as part of your

distributable.

My application simulates some stuff and needs measured data that is spread
over about 30 worksheets with about 2000 measurements pro worksheet. When
some measurements change, new worksheets are supplied. So I don't want to
convert the worksheets to a database tables each time some data changes.
Furthermore, the people that are going to work with the software know to
handle Excel workbooks, but hardly work with Acces databases.

Best regards,

Geert-Pieter
Jul 17 '05 #5

P: n/a
Maybe you are misreading the Excel licensing issue. If your users have Excel,
then they have the complete object model, as fully licensed as the rest of their
Excel. (You can develop and run an entire application in VBA for Excel in any
standard installation).

I don't think you can get around the password protection through any driver. It
wouldn't be much of a password protection if you could.

I think you should go ahead and go in through the object model. I have done it
several times, never redistributed any part of Excel, and never had complaints
that the program wouldn't run, as long as the user already had Excel installed.
(Had other complaints, of course, but that is programming).

"Geert-Pieter Hof" <g.*******@wbmt.tudelft.nl.blablabla> wrote in message
news:bj**********@azure.qinip.net...
There is also a ODBC driver available. This has never really appealed to

me
since Excel does not have a rigid table structure, so I've always gone
through the Object Model.


Now I'm becoming a bit confused: MS Knowledge Base Article 211378 states
that opening an password protected Excel workbook is not possible when using
the MS Excel ODBC driver, so the above suggestion won't work.

However, I am using the MS Jet OLE DB driver and I also can't open a
password protected Excel workbook, although this problem isn't mentioned in
MS Knowledge Base Article 211378. The MS Excel ODBC driver and the MS Jet
OLE DB driver are two different drivers, don't you think?

Also, you better check the dependencies ... who knows if the user needs to
have XL on their PC for the ODBC drivers to work.

Do you mind if I ask why you are using an Excel file? I am assuming, from
comments in this thread, the XL file is yours as part of your

distributable.

My application simulates some stuff and needs measured data that is spread
over about 30 worksheets with about 2000 measurements pro worksheet. When
some measurements change, new worksheets are supplied. So I don't want to
convert the worksheets to a database tables each time some data changes.
Furthermore, the people that are going to work with the software know to
handle Excel workbooks, but hardly work with Acces databases.

Best regards,

Geert-Pieter

Jul 17 '05 #6

P: n/a
It's not a licensing issue, it's encryption. Password protecting an
Excel workbook encrypts its contents on disk and ADO has no way of
decrypting it.

"Steve Gerrard" <no*************@comcast.net> wrote in message news:<1p********************@comcast.com>...
Maybe you are misreading the Excel licensing issue. If your users have Excel,
then they have the complete object model, as fully licensed as the rest of their
Excel. (You can develop and run an entire application in VBA for Excel in any
standard installation).

I don't think you can get around the password protection through any driver. It
wouldn't be much of a password protection if you could.

I think you should go ahead and go in through the object model. I have done it
several times, never redistributed any part of Excel, and never had complaints
that the program wouldn't run, as long as the user already had Excel installed.
(Had other complaints, of course, but that is programming).

"Geert-Pieter Hof" <g.*******@wbmt.tudelft.nl.blablabla> wrote in message
news:bj**********@azure.qinip.net...
There is also a ODBC driver available. This has never really appealed to me since Excel does not have a rigid table structure, so I've always gone
through the Object Model.


Now I'm becoming a bit confused: MS Knowledge Base Article 211378 states
that opening an password protected Excel workbook is not possible when using
the MS Excel ODBC driver, so the above suggestion won't work.

However, I am using the MS Jet OLE DB driver and I also can't open a
password protected Excel workbook, although this problem isn't mentioned in
MS Knowledge Base Article 211378. The MS Excel ODBC driver and the MS Jet
OLE DB driver are two different drivers, don't you think?

Also, you better check the dependencies ... who knows if the user needs to
have XL on their PC for the ODBC drivers to work.

Do you mind if I ask why you are using an Excel file? I am assuming, from
comments in this thread, the XL file is yours as part of your

distributable.

My application simulates some stuff and needs measured data that is spread
over about 30 worksheets with about 2000 measurements pro worksheet. When
some measurements change, new worksheets are supplied. So I don't want to
convert the worksheets to a database tables each time some data changes.
Furthermore, the people that are going to work with the software know to
handle Excel workbooks, but hardly work with Acces databases.

Best regards,

Geert-Pieter

Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.