help needed please - Office UserName
help needed please - Office UserName
help needed please - Office UserName
help needed please - Office UserName
help needed please - Office UserName
help needed please - Office UserName help needed please - Office UserName help needed please - Office UserName help needed please - Office UserName help needed please - Office UserName help needed please - Office UserName help needed please - Office UserName help needed please - Office UserName
help needed please - Office UserName help needed please - Office UserName
help needed please - Office UserName
Go Back  Xtreme Visual Basic Talk > > > help needed please - Office UserName


Reply
 
Thread Tools Display Modes
  #1  
Old 06-24-2005, 08:12 AM
-Monkey- -Monkey- is offline
Newcomer
 
Join Date: Jun 2005
Posts: 1
Exclamation help needed please - Office UserName


Hello,

First time here. I'm writing a macro in Word that will automatically update several users' Outlook signatures to match our corporate house style.

I need the VB code to determine the settings directory on the user's machine, e.g. C:\Documents and Settings\[UserName]\Application Data.... etc. When I use UserName in the VB code, it doesn't return the correct name.

For example, in VB, UserName returns "John Smith" but the folder name in the path is actually "John.Smith". This isn't a consistent rule however, so adding a period into the returned name is not a solution.

The question is, how can I determine the precise folder name that's in use? I assume there's a system variable that contains it (?)

Greatly appreciate any help anyone can give me, else I'll get roasted for dragging my feet with this. Everything else in the macro works a treat.

thanks,
Paul.
Reply With Quote
  #2  
Old 06-24-2005, 09:07 AM
italkid's Avatar
italkid italkid is offline
Down...

Retired Moderator
* Expert *
 
Join Date: Dec 2002
Location: Belgium.
Posts: 6,731
Default

You might try "UserProfile" instead, which does return:
Code:
C:\Documents and Settings\MyName
on my system...
Reply With Quote
  #3  
Old 06-24-2005, 09:37 AM
jayceepoo's Avatar
jayceepoo jayceepoo is offline
Senior Contributor
 
Join Date: Jul 2002
Posts: 1,021
Default

You could use:
Code:
Environment.GetEnvironmentVariable("userprofile")
Or
Code:
Environ("userprofile")
__________________
Jayceepoo

"I recently went to a new doctor and noticed he was located in something called the Professional Building. I felt better right away." - George Carlin
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
help needed please - Office UserName
help needed please - Office UserName
help needed please - Office UserName help needed please - Office UserName
help needed please - Office UserName
help needed please - Office UserName
help needed please - Office UserName help needed please - Office UserName help needed please - Office UserName help needed please - Office UserName help needed please - Office UserName help needed please - Office UserName help needed please - Office UserName
help needed please - Office UserName
help needed please - Office UserName
 
help needed please - Office UserName
help needed please - Office UserName
 
-->