Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Inability to Capture Username

Hi,

I have created an install routine using a Userform that runs code
conditional to the Username. However, the procedure is not recognizing
the value of the strName variable.

================

Sub cmdNext_Click()
Dim strName as String
strName = Environ("Username")

If strName = "doej" Or strName = "doex" Then GoTo X_Only Else GoTo
Y_Only

X_Only:
' Code here.....

Y_Only:
' Code here...

End Sub

=================

Any help you can lend would be appreciated.

Henry

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inability to Capture Username


Hello Henry,

The way you have have written your SUB the Y_Only routine will always
exceute. Try this and see if your problem goes away...

Sub cmdNext_Click()
Dim strName as String
strName = Environ("Username")

If strName = "doej" Or strName = "doex" Then
GoTo X_Only
Else
GoTo Y_Only
End If

'Any other code goes here...
Exit Sub

X_Only:
' Code here.....
Exit Sub

Y_Only:
' Code here...
Exit Sub

End Sub

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=513807

  #3   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Inability to Capture Username

This worked for me!

Possibly there isn't anyone logged in??

Regards,
GS

"Henry Stockbridge" wrote:

Hi,

I have created an install routine using a Userform that runs code
conditional to the Username. However, the procedure is not recognizing
the value of the strName variable.

================

Sub cmdNext_Click()
Dim strName as String
strName = Environ("Username")

If strName = "doej" Or strName = "doex" Then GoTo X_Only Else GoTo
Y_Only

X_Only:
' Code here.....

Y_Only:
' Code here...

End Sub

=================

Any help you can lend would be appreciated.

Henry


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
What is the formula to capture username from system into excel she Dave VB logic for excel Excel Discussion (Misc queries) 4 March 1st 11 12:40 PM
How to capture Username into specific cells [email protected] Excel Worksheet Functions 6 March 15th 09 06:19 PM
What is the function for system to capture the username Dave VB logic for excel Excel Discussion (Misc queries) 4 March 7th 09 07:33 AM
What is the fucntion or formula to capture username into excel she Dave VB logic for excel Excel Discussion (Misc queries) 1 March 5th 09 11:34 PM
Excel screen capture to capture cells and row and column headings jayray Excel Discussion (Misc queries) 5 November 2nd 07 11:01 PM


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