login

aidan_soccer11

New Member
Joined
Jul 11, 2006
Messages
14
hi all i just want to know , when i open my workbook i want it to pop up with a box saying like a user name so if some1 put (o lets just say "tony") once they clicked ok its would say Welcome Tony


could some1 help


thanks
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
In the Workbook_Open event, try something like:
Code:
Private Sub Workbook_Open()
    Dim theUser As String
    theUser = InputBox("Enter your name", "Welcome")
    If theUser = "" Then
        MsgBox "No user name entered."
    Else
        MsgBox "Welcome " & theUser & "!"
    End If
End Sub
 
Upvote 0
Another option, to simply capture the logged in user name on the computer rather than prompting the user:
Code:
Private Sub Workbook_Open()
    MsgBox "Welcome " & Environ("USERNAME") & "!"
End Sub
 
Upvote 0
Popup?
Code:
Private Sub Workbook_Open()
    CreateObject("WScript.Shell").Popup Environ("username"), 3
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,272
Messages
6,129,822
Members
449,538
Latest member
cookie2956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top