473,608 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open password protected Excel workbook in Visual Basic

Hello,

My VB 6.0 application read and writes data from and to a MS Excel workbook,
using the Microsoft.Jet.O LEDB.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
6 25250
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
/deovrmicrosofte xcel2000.asp

Good luck,
--
John MacIntyre
VC++ / VB / ASP / Database Developer
http://www.johnmacintyre.ca
"Geert-Pieter Hof" <g.*******@wbmt .tudelft.nl.bla blabla> 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.O LEDB.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
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.t o.group.thx> schreef in bericht
news:wh******** ***********@new s20.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.bla blabla> 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.O LEDB.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
"Geert-Pieter Hof" <g.*******@wbmt .tudelft.nl.bla blabla> 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
> 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
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.bla blabla> 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
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******* *************@c omcast.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.bla blabla> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
35520
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy utility from my PythonWin (IDE from ActiveSTate),
3
7418
by: Jennyfer Barco | last post by:
Hello, I have a question, how can I open Microsoft Excel from .NET. I only need to open a new file in Excel and paste some information and set the Microsoft Excel as the enabled aplication, so the user can continue working in Excel and he'll save the information I pasted. I tried this but doesn't open Excel at all, but it does save the file c:\test.xls with the value "This is column B row 2" in colum B and row 2: Dim xlApp As...
2
2628
by: Dominic | last post by:
Hi I've done a lot in Excel Automation in prior C# and VB.Net Versions...but I've no chance just to open an Excel Workbook with Visual Studio 2005. I've go always these HRESULT-Failures...:-( Thanks for your help... Here's one of the code trials:
10
8188
by: Steve | last post by:
I am trying to create a DLL in Visual Studio 2005-Visual Basic that contains custom functions. I believe I need to use COM interop to allow VBA code in Excel 2002 to access it. I've studied everything I can find on COM Interop and .NET. I've also tried many of the 'Walkthroughs' on the MSDN site relating to COM add-ins, .NET and Office XP but am unable to get even these working in Excel 2002 or Word 2002. I've installed the Office XP...
3
3996
by: dan_roman | last post by:
Hi, I developed a script with a nice interface in Tkinter that allows me to edit some formulas and to generate an Excel worksheet with VBA macros within it. The script runs perfectlly in Office 2000, but in Office 2003 crash at line: "wbc = workbook.VBProject.VBComponents.Add(1)" Please help me :-( the code of the module that crash is (only in Excel 2003, in 2000 not): import os
0
1572
by: guptasourav | last post by:
I am opening an Excel file on my server, and saving it with some other name and then trying to coping the new excel to my local machine. If i use a simple Excel(without macro but with password) it works properly but if i use a macro and make the excel password protected then it does not allow me to open it. It does not give any exception but on reaching to "oWB = oXL.Workbooks.Open(" it hangs up. Private Sub Page_Load(ByVal sender As...
2
4920
by: Nicholas Dreyer | last post by:
The following error Run-time exception thrown : System.Runtime.InteropServices.COMException - Error loading type library/DLL. happens while running the code listed at the bottom of this message in the environment shown here: Operating System: Microsoft Windows Version 5.1 (Build
5
5766
by: HDI | last post by:
Hi, How can I programmatically open a password protected excel-sheet? Thx
0
5086
by: mix01 | last post by:
Hi, I am trying to get some VBA code working, but am preplex as to why it does not work. I would really appreciate any level of help. Many thanks, Mix01 Version of the program
0
8069
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8011
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8503
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8160
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8358
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5482
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2479
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1339
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.