Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change a constant from VB


Is there a way to change a constant from within VB.

I know this isn't terribly secure, however it will meet my needs......

I have a workbook that is protected, with some unprotected fields. Th
protection password is declared as a constant in the AutoOpen macro ie:

Password = "1234"

I then have a lock and unlock button with macros assigned to them t
use this password to protect and unprotect the sheet.

I'd like to give the user the ability to change that password.

I know I could do this by storing the password string in a hidden shee
in the workbook, but that woudl be very easy for someone to use
different workbook to reference that sheet rom a different file and ge
the password.

So what I'd like to do is create a macros that could alter that line o
VB .....

is it possible?

Cliv

--
ccarmoc
-----------------------------------------------------------------------
ccarmock's Profile: http://www.excelforum.com/member.php...fo&userid=2767
View this thread: http://www.excelforum.com/showthread.php?threadid=53946

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Change a constant from VB

As far as I am aware a constant is just that, and once your code is running,
any attempt to change it should fail.

Why not encypt the password in some way and store it in the registry?

Have a look at SaveSetting in the help files.

Robin Hammond
www.enhanceddatasystems.com

"ccarmock" wrote in
message ...

Is there a way to change a constant from within VB.

I know this isn't terribly secure, however it will meet my needs......

I have a workbook that is protected, with some unprotected fields. The
protection password is declared as a constant in the AutoOpen macro ie:

Password = "1234"

I then have a lock and unlock button with macros assigned to them to
use this password to protect and unprotect the sheet.

I'd like to give the user the ability to change that password.

I know I could do this by storing the password string in a hidden sheet
in the workbook, but that woudl be very easy for someone to use a
different workbook to reference that sheet rom a different file and get
the password.

So what I'd like to do is create a macros that could alter that line of
VB .....

is it possible?

Clive


--
ccarmock
------------------------------------------------------------------------
ccarmock's Profile:
http://www.excelforum.com/member.php...o&userid=27670
View this thread: http://www.excelforum.com/showthread...hreadid=539462



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Change a constant from VB

If your not going to lock your project, then it would be even easier to look
in your code to get the password. If you do lock your project, then you
won't be able to alter it with code. Also, in later versions of excel, the
user has to allow code to have access to the vbe.

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

--
Regards,
Tom Ogilvy

"ccarmock" wrote in
message ...

Is there a way to change a constant from within VB.

I know this isn't terribly secure, however it will meet my needs......

I have a workbook that is protected, with some unprotected fields. The
protection password is declared as a constant in the AutoOpen macro ie:

Password = "1234"

I then have a lock and unlock button with macros assigned to them to
use this password to protect and unprotect the sheet.

I'd like to give the user the ability to change that password.

I know I could do this by storing the password string in a hidden sheet
in the workbook, but that woudl be very easy for someone to use a
different workbook to reference that sheet rom a different file and get
the password.

So what I'd like to do is create a macros that could alter that line of
VB .....

is it possible?

Clive


--
ccarmock
------------------------------------------------------------------------
ccarmock's Profile:

http://www.excelforum.com/member.php...o&userid=27670
View this thread: http://www.excelforum.com/showthread...hreadid=539462



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I change the tab but keep the row and column constant when MG Excel Worksheet Functions 25 June 20th 07 01:51 PM
Constant loan payments vs. constant payments of principal lalli945 Excel Worksheet Functions 3 December 20th 06 10:33 PM
Constant sedonovan Excel Discussion (Misc queries) 5 June 23rd 06 11:43 AM
Constant? in VBA have_a_cup Excel Discussion (Misc queries) 1 June 14th 06 01:39 AM
Constant Warrio[_2_] Excel Programming 6 October 22nd 03 04:41 PM


All times are GMT +1. The time now is 04:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"