ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reading a VBA constant value by an outsider macro? (https://www.excelbanter.com/excel-programming/276272-re-reading-vba-constant-value-outsider-macro.html)

Tom Ogilvy

Reading a VBA constant value by an outsider macro?
 
If the project is not locked, look at

http://www.cpearson.com/excel/vbe.htm

for how to use code to work with code (you should be able to read your
constant by reading the lines of code in the code module).

However, if you don't lock you code, then anyone can go into your code
module and read the constant.

Maybe you could create a custom document property that holds an
encoded/scrambled version of the password and provide the code to
unencode/unscramble it.

http://www.cpearson.com/excel/docprop.htm


http://support.microsoft.com/default...b;en-us;224351
Dsofile.exe Lets You Edit Office Document Properties from Visual Basic and
ASP

--
Regards,
Tom Ogilvy



Rob wrote in message
m...
Hello FellowNewsgroupReaders,

I think I know quite a lot of protecting my projects and spreadheets.
I create a workbook called "A.XLS".
VBA code stores a password to open another sheet.
In VBA I declare a constant, like
const constPass = "123"
I protect the VBA code with a password.

If I open "A.xls" and create another sheet "B.xls", is it possible to
create code to read the constant from the VBA in "A.xls"?

I suspect it is NOT possible. I just want to know IF it possible in any

way.
If so, I cannot store my password in a constant and I need to find another
solution. But the solution above will help me make things easier.

Am I right with this?

Regards,
Rob Zoomer





Tom Ogilvy

Reading a VBA constant value by an outsider macro?
 
Just note that creating a reference to a workbook causes that workbook to
open when you open the referencing workbook. If you close the referencing
workbook, the reference workbook doesn't close automatically and it can't be
closed while the referencing workbook is still open.

--
Regards,
Tom Ogilvy

Rob wrote in message
m...
Tom,
thank u for refering to the pages of Chip. He also answered my question

and
gave a valuable solution. I already had the links to his pages, but better

a
double reference than no reference at all.

Regards,
Rob

"Tom Ogilvy" schreef in bericht
...
If the project is not locked, look at

http://www.cpearson.com/excel/vbe.htm

for how to use code to work with code (you should be able to read your
constant by reading the lines of code in the code module).

However, if you don't lock you code, then anyone can go into your code
module and read the constant.

Maybe you could create a custom document property that holds an
encoded/scrambled version of the password and provide the code to
unencode/unscramble it.

http://www.cpearson.com/excel/docprop.htm


http://support.microsoft.com/default...b;en-us;224351
Dsofile.exe Lets You Edit Office Document Properties from Visual Basic

and
ASP

--
Regards,
Tom Ogilvy



Rob wrote in message
m...
Hello FellowNewsgroupReaders,

I think I know quite a lot of protecting my projects and spreadheets.
I create a workbook called "A.XLS".
VBA code stores a password to open another sheet.
In VBA I declare a constant, like
const constPass = "123"
I protect the VBA code with a password.

If I open "A.xls" and create another sheet "B.xls", is it possible to
create code to read the constant from the VBA in "A.xls"?

I suspect it is NOT possible. I just want to know IF it possible in

any
way.
If so, I cannot store my password in a constant and I need to find

another
solution. But the solution above will help me make things easier.

Am I right with this?

Regards,
Rob Zoomer










All times are GMT +1. The time now is 09:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com