+ Reply to Thread
Results 1 to 2 of 2

Refresh Code Question

  1. #1
    ~C
    Guest

    Refresh Code Question

    I have the following code in a spreadsheet:

    Function NetworkUserName() As String
    Dim response
    NetworkUserName = Environ("Username")
    Application.Volatile
    End Function


    I have placed this worksheet on our company network so that many people can
    access it. However, it saves my username and does not refresh to display the
    current user's information unless they go to that cell and press Enter. How
    can I get it to refresh when the file is opened?

    Thanks!

    ~C

  2. #2
    Bob Phillips
    Guest

    Re: Refresh Code Question

    '-----------------------------------------------------------------
    Private Sub Workbook_Open()
    '-----------------------------------------------------------------
    Worksheets("Sheet1").Range("A1").Value = Environ("Username")
    End Sub

    'This is workbook event code.
    'To input this code, right click on the Excel icon on the worksheet
    '(or next to the File menu if you maximise your workbooks),
    'select View Code from the menu, and paste the code

    --
    HTH

    Bob Phillips

    (remove xxx from email address if mailing direct)

    "~C" <[email protected]> wrote in message
    news:[email protected]...
    > I have the following code in a spreadsheet:
    >
    > Function NetworkUserName() As String
    > Dim response
    > NetworkUserName = Environ("Username")
    > Application.Volatile
    > End Function
    >
    >
    > I have placed this worksheet on our company network so that many people

    can
    > access it. However, it saves my username and does not refresh to display

    the
    > current user's information unless they go to that cell and press Enter.

    How
    > can I get it to refresh when the file is opened?
    >
    > Thanks!
    >
    > ~C




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1