VBA code determine if user logged in
-
- Posts: 21
- Joined: Thu Jan 29, 2009 11:32 am
- OLAP Product: Planning Analytics
- Version: 10.1
- Excel Version: Office 365
VBA code determine if user logged in
Is there a way to determine through VBA whether a user is logged in to TM1? I have a reporting spreadsheet with a lot of VBA code, some of which I only want to execute if the user is logged in.
-
- Site Admin
- Posts: 6645
- Joined: Sun May 11, 2008 2:30 am
- OLAP Product: TM1
- Version: PA2.0.9.18 Classic NO PAW!
- Excel Version: 2013 and Office 365
- Location: Sydney, Australia
- Contact:
Re: VBA code determine if user logged in
There was a TM1User worksheet function introduced with 9.1 SP2. From your profile, it should be available for you:mitch23 wrote:Is there a way to determine through VBA whether a user is logged in to TM1? I have a reporting spreadsheet with a lot of VBA code, some of which I only want to execute if the user is logged in.
You can use the Application.Run method to access the worksheet function via VBA.The TM1User worksheet function returns the user name of the current TM1 user.
If the current TM1 user is not connected to a server, or if the specified server is not running, TM1User returns an empty string.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-
- MVP
- Posts: 3698
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: VBA code determine if user logged in
Its not really clear what exactly you mean or from whose perspective you are meaning but in either case I think no vba is necessary.
If you mean that YOU as an administrator only want to do certain processes if a user is logged in you can do this just by reading the ClientProperties cube with a DBR.
If you mean certain vba should only be run by THE USER if they are logged in you could just put in a simple check to a DBR reference, if the cell returns a KEY ERR then the user is not logged in. (or if you want you could do a test with the NCONNECT macro function).
Hope that helps.
If you mean that YOU as an administrator only want to do certain processes if a user is logged in you can do this just by reading the ClientProperties cube with a DBR.
If you mean certain vba should only be run by THE USER if they are logged in you could just put in a simple check to a DBR reference, if the cell returns a KEY ERR then the user is not logged in. (or if you want you could do a test with the NCONNECT macro function).
Hope that helps.