I am making a template that sever users will be using this amp; I don't know how
to automatically put the logged in users name into the header. Can someone
help with this???
Hello Taurus,
The name of the current user can be returned using
Application.UserName. There are 3 headers on each Worksheet, Left,
Center, and Right. These are accessed through PageSetup.
Example for Left Header:
Worksheets(quot;Sheet1quot;).PageSetup.LeftHeader = Application.UserName
Example for Center Header:
Worksheets(quot;Sheet1quot;).PageSetup.CenterHeader = Application.UserName
Example for Right Header:
Worksheets(quot;Sheet1quot;).PageSetup.RightHeader = Application.UserName
Remember this has to be done to each sheet you want a header to appear
on. Replace quot;Sheet1quot; in the examples with the name of Worksheet that
will have a header.
Sincerely,
Leith Ross--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: www.excelforum.com/member.php...oamp;userid=18465
View this thread: www.excelforum.com/showthread...hreadid=504577Leith,
Is this using the VBA part of excel? I am pretty much a newbie in that. I
have written any type of VB code in a while... I will try to keep at it but
s far I am unsuccsessful.
Sincerely, Taurus.
quot;Leith Rossquot; wrote:
gt;
gt; Hello Taurus,
gt;
gt; The name of the current user can be returned using
gt; Application.UserName. There are 3 headers on each Worksheet, Left,
gt; Center, and Right. These are accessed through PageSetup.
gt;
gt; Example for Left Header:
gt; Worksheets(quot;Sheet1quot;).PageSetup.LeftHeader = Application.UserName
gt;
gt; Example for Center Header:
gt; Worksheets(quot;Sheet1quot;).PageSetup.CenterHeader = Application.UserName
gt;
gt; Example for Right Header:
gt; Worksheets(quot;Sheet1quot;).PageSetup.RightHeader = Application.UserName
gt;
gt; Remember this has to be done to each sheet you want a header to appear
gt; on. Replace quot;Sheet1quot; in the examples with the name of Worksheet that
gt; will have a header.
gt;
gt; Sincerely,
gt; Leith Ross
gt;
gt;
gt; --
gt; Leith Ross
gt; ------------------------------------------------------------------------
gt; Leith Ross's Profile: www.excelforum.com/member.php...oamp;userid=18465
gt; View this thread: www.excelforum.com/showthread...hreadid=504577
gt;
gt;
- Jul 25 Fri 2008 20:45
How do you reference the logged on user name in excel?
close
全站熱搜
留言列表
發表留言