getObject and password protected workbook

E

Edward

Hi everybody,
I use an Excel file as my database and because of the security reasons I
want to make it protected , I have a second file that is shared among users
and this second file reads some data from the first file
I use
Set appExcelData = GetObject(filePath)
to reference the first file , but when I password protect it , it asks the
users for the password , how can I reference the first file and read its data
with giving the password somehwere in my code?
I know if I use open there is a parameter for password but I don't want to
open the file.
 
J

Joel

You have to have the password in your code. But then you protect the VBA
module so people cannot read the pasword in the macro.
 
E

Edward

Thanks. I know that I need to ahev the password in my code but my question
was how? I use getobject not open that has password as one of it's parameters
 
J

Joel

The object that is returned from GetObject is the same object that is
returned from an open workbooks. I don't know how you are protect the
workbook. Are you using an excel protection method or a window protectipi
method. What advantages Do you think you are achieving by using the
GetObject instead of Open workbooks.

If you have a shared file and want to Open the books as shared you could use
the ADO method. Right now I confused by the approach you are taking.

I don't recommend use Excel for shared apllications. Excel is not designed
to prevent sharing problems. I prefer to use Access for shared files and let
the user have access to the database by using a Query Table in an Excel
workbook.
 
C

Chip Pearson

Why are you using GetObject in the first place?

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

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