Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Public Variable

Can someone explain how to assign a public variable to my whole workbook so that it is recognized by all sheets
I want my password as a variable so that I don't have to change it in one place verses all of my sheets

Any help thanks in advance


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Public Variable

Jason wrote:
Can someone explain how to assign a public variable to my whole
workbook so that it is recognized by all sheets? I want my password
as a variable so that I don't have to change it in one place verses
all of my sheets.

Any help thanks in advance.


How are you storing it now ? because you could use a workbook name (possibly
hidden to add one layer of security), but if all you want is a public
variable, then put something like

Public ThePassword As String

at the top of one standard module.

You can define it as a constant, like

Public Const ThePassword As String = "123456"

--
Regards,

Juan Pablo González


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Public Variable

I have various input boxes on different sheets prompting for password. So on each sheet for each input box it is listed as
I basically want to change all my passwords at once with another input box, so that is why I need a public variable defined for all sheets or workbook. I think what you wrote will work for what I have. Not much security needed either

psw=Inputbox("Please Enter Password"
if psw = "MyPassword" the
my cod
end i


----- Juan Pablo González wrote: ----

Jason wrote
Can someone explain how to assign a public variable to my whol
workbook so that it is recognized by all sheets? I want my passwor
as a variable so that I don't have to change it in one place verse
all of my sheets
Any help thanks in advance


How are you storing it now ? because you could use a workbook name (possibl
hidden to add one layer of security), but if all you want is a publi
variable, then put something lik

Public ThePassword As Strin

at the top of one standard module

You can define it as a constant, lik

Public Const ThePassword As String = "123456

--
Regards

Juan Pablo Gonzále



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Public Variable

"Jason" wrote in message
...
Can someone explain how to assign a public variable to my whole workbook

so that it is recognized by all sheets?
I want my password as a variable so that I don't have to change it in one

place verses all of my sheets.
Try the following code at the top of your first module: The string variable
"Password" should be visible throughout your project.

OPTION EXPLICIT

Public strPassword as String



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Public Variable

Thanks to all who responded. I am learning quite a bit about VBA, but little things I am still finding out.


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
Set Public Variable on Open jlclyde Excel Discussion (Misc queries) 4 September 11th 09 07:03 PM
Public variable Jack New Users to Excel 4 March 18th 06 09:35 PM
Public/Procedure Variable Otto Moehrbach[_6_] Excel Programming 2 February 6th 04 04:58 PM
Scope of a public variable Jos Vens Excel Programming 0 November 24th 03 10:08 AM
public variable marwan hefnawy Excel Programming 1 September 5th 03 08:54 AM


All times are GMT +1. The time now is 05:26 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"