Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Using classes to store user credentials

Hi,

I consider using a class to store if the user has been authorized.
Something like:
Dim thisUser as new clsUser
thisUser.IsAuthorized = True

But I don't know how to preserve this instance of the class, together with
it's properties, throughout the life of the application.

Could you help me?

Thank's in advance

Philippe


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Using classes to store user credentials

Create a Collection object as a global variable (declared outside
of and prior to any procedure in the module), and then use
Set/New to create an instance of your class, then store that
instance in the collection. E.g.,


Dim MyUsers As New Collection

Sub MySub()
Dim thisUser As clsUser
Set thisUser = New clsUser
MyUsers.Add thisUser
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Philippe Pons" wrote in
message ...
Hi,

I consider using a class to store if the user has been
authorized.
Something like:
Dim thisUser as new clsUser
thisUser.IsAuthorized = True

But I don't know how to preserve this instance of the class,
together with
it's properties, throughout the life of the application.

Could you help me?

Thank's in advance

Philippe




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Using classes to store user credentials

Thank you Chip,

A further question if you mind.
How can I get to the thisUser properties later on, I mean during execution
of a diffrent procedure.
If I write: MyUsers.thisUser.someProp, I get an error that MyUsers is
undefined!

TIA,
Philippe

"Chip Pearson" a écrit dans le message de
...
Create a Collection object as a global variable (declared outside
of and prior to any procedure in the module), and then use
Set/New to create an instance of your class, then store that
instance in the collection. E.g.,


Dim MyUsers As New Collection

Sub MySub()
Dim thisUser As clsUser
Set thisUser = New clsUser
MyUsers.Add thisUser
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Philippe Pons" wrote in
message ...
Hi,

I consider using a class to store if the user has been
authorized.
Something like:
Dim thisUser as new clsUser
thisUser.IsAuthorized = True

But I don't know how to preserve this instance of the class,
together with
it's properties, throughout the life of the application.

Could you help me?

Thank's in advance

Philippe






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Using classes to store user credentials

You need to access the Collection item. E.g.,

MyUsers(1).SomeProp


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Philippe Pons" wrote in
message ...
Thank you Chip,

A further question if you mind.
How can I get to the thisUser properties later on, I mean
during execution
of a diffrent procedure.
If I write: MyUsers.thisUser.someProp, I get an error that
MyUsers is
undefined!

TIA,
Philippe

"Chip Pearson" a écrit dans le message de
...
Create a Collection object as a global variable (declared
outside
of and prior to any procedure in the module), and then use
Set/New to create an instance of your class, then store that
instance in the collection. E.g.,


Dim MyUsers As New Collection

Sub MySub()
Dim thisUser As clsUser
Set thisUser = New clsUser
MyUsers.Add thisUser
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Philippe Pons" wrote in
message ...
Hi,

I consider using a class to store if the user has been
authorized.
Something like:
Dim thisUser as new clsUser
thisUser.IsAuthorized = True

But I don't know how to preserve this instance of the class,
together with
it's properties, throughout the life of the application.

Could you help me?

Thank's in advance

Philippe








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
Excel user enter a store # to query Access data base liem Excel Discussion (Misc queries) 0 January 16th 10 03:45 AM
Excel paste ask user credentials Surjeet Gill Excel Discussion (Misc queries) 0 November 12th 08 04:29 PM
store inventory sheet(ex:sports equipment store) vardan Excel Worksheet Functions 1 October 11th 06 12:51 AM
Verifying your credentials for opening content with restricted pe. Arun Excel Discussion (Misc queries) 0 September 6th 06 03:41 PM
Can a service account be embedded in Workbook so that by default the macros are run with service account credentials and not the user credentials??? Divya Sanam Excel Discussion (Misc queries) 0 July 20th 06 05:15 PM


All times are GMT +1. The time now is 04:14 AM.

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"