Unique value of Excel file

W

witek

I am looking for something which can serve as unique value for
individual Excel file.

It should be:
- unique for each individually created file (file -> new)
- should not change if you make a copy of the file (save as) or
modify the file
- user should not be able to modify it (or at least it should be hard
to do).

any ideas?
 
G

GS

After serious thinking witek wrote :
I am looking for something which can serve as unique value for individual
Excel file.

It should be:
- unique for each individually created file (file -> new)
- should not change if you make a copy of the file (save as) or modify the
file
- user should not be able to modify it (or at least it should be hard to
do).

any ideas?

You can store a value in a DefinedName, then hide the name so it
doesn't show up in lists. You do this by setting its .Visible property
to False.

ActiveWorkbook.Names.Add "UniqueName", "UniqueValue", False

To validate the workbook...

In some procedure:
Dim sMsg$
If bNameExists("UniqueName") Then _
sMsg = "Validated" Else sMsg = "Not Validated"


A reusable function to check a workbook for an existing name:

Function bNameExists(sDefinedName$, Optional Wkb As Workbook) As
Boolean
Dim x As Object
If Wkb Is Nothing Then Set Wkb = ActiveWorkbook
On Error Resume Next
Set x = Wkb.Names(sDefinedName)
bNameExists = (Err = 0)
End Function

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
W

witek

GS said:
You can store a value in a DefinedName, then hide the name so it doesn't
show up in lists. You do this by setting its .Visible property to False.

ActiveWorkbook.Names.Add "UniqueName", "UniqueValue", False


For now it is the only solution I know.
however value can be changed by any addin installed.
 
G

GS

witek has brought this to us :
For now it is the only solution I know.
however value can be changed by any addin installed.

True.., so long as the addin knows the unique name. While anything is
possible (ergo NOTHING is 100% secure), it's logical to presume the
average user will not mess with things since their objective is to use
the file for its intended purpose.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
W

witek

GS said:
witek has brought this to us :

True.., so long as the addin knows the unique name.

The problem is that addin can list hidden names.
If hidden or "secure" names could only be listed by module which created
them it would be perfect.
There is such thing in c++/XLL programming but name can be accessed only
if worksheet with this name is active. It does not work for me. I have
to have access to it all time.
While anything is
possible (ergo NOTHING is 100% secure), it's logical to presume the
average user will not mess with things since their objective is to use
the file for its intended purpose.
the problem is that is a goal for a user. To find that information and
copy it to other workbooks.

It must be something which user can't read or can't find.

thanks for help.
 
G

GS

witek pretended :
The problem is that addin can list hidden names.
If hidden or "secure" names could only be listed by module which created them
it would be perfect.
There is such thing in c++/XLL programming but name can be accessed only if
worksheet with this name is active.

That's absolutely not true! Any programming language can access names
without even opening the file!
It does not work for me. I have to have
access to it all time.

the problem is that is a goal for a user. To find that information and copy
it to other workbooks.

It must be something which user can't read or can't find.

The above statement contradicts the previous statement. If it's the
goal of users to find and copy the info then your quest for something
they can't read/find is pointless, ..now isn't it? I think you're SOL!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
W

witek

GS said:
witek pretended :

That's absolutely not true! Any programming language can access names
without even opening the file!

how can you access anything in the file without opening it?
reading sectors on hard drive?

I know that you can access xml. That is another thing I do not like in
open format.

The above statement contradicts the previous statement. If it's the goal
of users to find and copy the info then your quest for something they
can't read/find is pointless, ..now isn't it? I think you're SOL!
that information is not for user it is for program
program can, user does not have to.

think about cryptography and credit cards.
you can't access data stored on a chip. Program can.
 
G

GS

Any program that uses ADODB can access data from Excel files without
opening them.

Unfortunately, your broken English makes your situation difficult to
understand. Perhaps if you try to clearly explain what it is that you
want to accomplish we can better help you!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 

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