![]() |
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 |
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 |
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 |
Inability to Capture Username
Many thanks.
|
All times are GMT +1. The time now is 12:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com