close

Hi all,

I have a workbook with multiple sheets. I want the sheet 1 always to
display first and is there a method to display the current user name which
updates it self automatically when different users use the book when its on
a share - I'm thinking of setting up a log. I've done the following as a
test but its not really what I want - ideally there would be a text box that
auto changes without it having to be clicked.

Sub logontest()
Worksheets(quot;Frontscreenquot;).Activate
Dim x
Set x = CreateObject(quot;WSCRIPT.Networkquot;)
Dim u
u = x.UserName
'update text box quot;Last Updated:quot;
ActiveSheet.TextBoxes(quot;txtLogonquot;).Text = quot;Current Logon : quot; amp; u
End Sub
Call you code from the workbook_open event

www.cpearson.com/excel/events.htm

Chip Pearson's page on events.

--
Regards,
Tom Ogilvy

quot;sacrumquot; gt; wrote in message
...
gt; Hi all,
gt;
gt; I have a workbook with multiple sheets. I want the sheet 1 always to
gt; display first and is there a method to display the current user name which
gt; updates it self automatically when different users use the book when its
on
gt; a share - I'm thinking of setting up a log. I've done the following as a
gt; test but its not really what I want - ideally there would be a text box
that
gt; auto changes without it having to be clicked.
gt;
gt; Sub logontest()
gt; Worksheets(quot;Frontscreenquot;).Activate
gt; Dim x
gt; Set x = CreateObject(quot;WSCRIPT.Networkquot;)
gt; Dim u
gt; u = x.UserName
gt;
gt;
gt;
gt; 'update text box quot;Last Updated:quot;
gt; ActiveSheet.TextBoxes(quot;txtLogonquot;).Text = quot;Current Logon : quot; amp; u
gt; End Sub
gt;
gt;

quot;Tom Ogilvyquot; gt; wrote in message
...
gt; Call you code from the workbook_open event
gt;
gt; www.cpearson.com/excel/events.htm
gt;
gt; Chip Pearson's page on events.
gt;
gt; --
gt; Regards,
gt; Tom Ogilvy
gt;
gt; quot;sacrumquot; gt; wrote in message
gt; ...
gt;gt; Hi all,
gt;gt;
gt;gt; I have a workbook with multiple sheets. I want the sheet 1 always to
gt;gt; display first and is there a method to display the current user name
gt;gt; which
gt;gt; updates it self automatically when different users use the book when its
gt; on
gt;gt; a share - I'm thinking of setting up a log. I've done the following as a
gt;gt; test but its not really what I want - ideally there would be a text box
gt; that
gt;gt; auto changes without it having to be clicked.
gt;gt;
gt;gt; Sub logontest()
gt;gt; Worksheets(quot;Frontscreenquot;).Activate
gt;gt; Dim x
gt;gt; Set x = CreateObject(quot;WSCRIPT.Networkquot;)
gt;gt; Dim u
gt;gt; u = x.UserName
gt;gt;
gt;gt;
gt;gt;
gt;gt; 'update text box quot;Last Updated:quot;
gt;gt; ActiveSheet.TextBoxes(quot;txtLogonquot;).Text = quot;Current Logon : quot; amp; u
gt;gt; End Sub
gt;gt;
gt;gt;
gt;
Thanks - now sorted.

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()