Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default application.username

I'm trying to use <application.username in a footer, but seems that it
is only printing out as text [application.username] and not the actual
User's Name. Can this be done?

D.S.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default application.username

Hi Donald,

This works for me

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
.PageSetup.LeftFooter= Application.UserName
End With
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Donald Stockton" wrote in message
...
I'm trying to use <application.username in a footer, but seems that it
is only printing out as text [application.username] and not the actual
User's Name. Can this be done?

D.S.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default application.username

Hi
add the following code to your workbook module:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In me.worksheets
With wkSht.PageSetup
.CenterFooter = Application.UserName
End With
Next wkSht
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

Donald Stockton wrote:
I'm trying to use <application.username in a footer, but seems that
it is only printing out as text [application.username] and not the
actual User's Name. Can this be done?

D.S.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default application.username

I guess part of my problem is that I'm also trying to include some
formatting instruction in the footer. For instanc, my original code
line is this:
.RightFooter = "&D &T &""Brush Script MT,Italic""&14&UJ. Smith"

What I'm trying to do is replace <J. Smith with <application.username,
but haven't figured out the correct syntax to make it work.

D.S.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default application.username

Donald,

Try

RightFooter = "&D &T &""Brush Script MT,Italic""&14" & _
Application.UserName

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Donald Stockton" wrote in message
...
I guess part of my problem is that I'm also trying to include
some
formatting instruction in the footer. For instanc, my original
code
line is this:
RightFooter = "&D &T &""Brush Script MT,Italic""&14&UJ.
Smith"

What I'm trying to do is replace <J. Smith with
<application.username,
but haven't figured out the correct syntax to make it work.

D.S.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default application.username

Hi
just concatenate the username. e.g.
RightFooter = "&D &T &""Brush Script MT,Italic""&14 &
application.username

--
Regards
Frank Kabel
Frankfurt, Germany

Donald Stockton wrote:
I guess part of my problem is that I'm also trying to include some
formatting instruction in the footer. For instanc, my original code
line is this:
RightFooter = "&D &T &""Brush Script MT,Italic""&14&UJ. Smith"

What I'm trying to do is replace <J. Smith with
<application.username, but haven't figured out the correct syntax to
make it work.

D.S.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default application.username

Could I also suggest that, just in case you have numeric Usernames (they are
only ids after all) that you use

RightFooter = "&D &T &""Brush Script MT,Italic""&14 " &
Application.UserName

The extra space stops some unusual output (thanks to whoever it was that
suggested taht in a previous post of min, I think it was Chip, but I am not
sure).

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Chip Pearson" wrote in message
...
Donald,

Try

RightFooter = "&D &T &""Brush Script MT,Italic""&14" & _
Application.UserName

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Donald Stockton" wrote in message
...
I guess part of my problem is that I'm also trying to include
some
formatting instruction in the footer. For instanc, my original
code
line is this:
RightFooter = "&D &T &""Brush Script MT,Italic""&14&UJ.
Smith"

What I'm trying to do is replace <J. Smith with
<application.username,
but haven't figured out the correct syntax to make it work.

D.S.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default application.username

Thanks to all, that works. The extra space seems like a good safe guard to
keep a name beginning with a number from getting processed as part of the
font size.


"Frank Kabel" wrote in message
...
Hi
just concatenate the username. e.g.
RightFooter = "&D &T &""Brush Script MT,Italic""&14 &
application.username

--
Regards
Frank Kabel
Frankfurt, Germany

Donald Stockton wrote:
I guess part of my problem is that I'm also trying to include some
formatting instruction in the footer. For instanc, my original code
line is this:
RightFooter = "&D &T &""Brush Script MT,Italic""&14&UJ. Smith"

What I'm trying to do is replace <J. Smith with
<application.username, but haven't figured out the correct syntax to
make it work.

D.S.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
(username v1) JJernigan Excel Discussion (Misc queries) 0 June 12th 08 09:13 PM
Application.UserName Question HROBERTSON Excel Discussion (Misc queries) 5 January 8th 07 05:01 PM
Username Log PaulJ Excel Discussion (Misc queries) 8 March 1st 06 11:51 AM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
application.quit will not shut off application john Excel Programming 0 January 9th 04 11:29 PM


All times are GMT +1. The time now is 03:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"