By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,157 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

Getting the user profile folder

P: n/a
Hi

I need to get the signature folder for the current folder such as;
"F:\Documents and Settings\Dave\Application Data\Microsoft\Signatures\"
except that instead of Dave I need the correct name for the current user, s
that my code works generically regardless of who is logged in. Is there a
way to do that?

Thanks

Regards
Jan 15 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Sun, 15 Jan 2006 01:32:00 -0000, "John" <Jo**@nospam.infovis.co.uk> wrote:
Hi

I need to get the signature folder for the current folder such as;
"F:\Documents and Settings\Dave\Application Data\Microsoft\Signatures\"
except that instead of Dave I need the correct name for the current user, s
that my code works generically regardless of who is logged in. Is there a
way to do that?

Thanks

Regards


http://www.mvps.org/access/api/api0054.htm
Wayne Gillespie
Gosford NSW Australia
Jan 15 '06 #2

P: n/a
Wayne Gillespie <be*****@NOhotmailSPAM.com.au> wrote in
news:p8********************************@4ax.com:
On Sun, 15 Jan 2006 01:32:00 -0000, "John"
<Jo**@nospam.infovis.co.uk> wrote:
I need to get the signature folder for the current folder such as;
"F:\Documents and Settings\Dave\Application
Data\Microsoft\Signatures\" except that instead of Dave I need the
correct name for the current user, s that my code works
generically regardless of who is logged in. Is there a way to do
that?


http://www.mvps.org/access/api/api0054.htm


Er, what's wrong with this?

Environ("USERPROFILE")

Lots less code, it seems to me.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Jan 15 '06 #3

P: n/a
Nothing.

Knowing how to get a handle to all the special folders is very useful
though.

--

Terry Kreft
"David W. Fenton" <XX*******@dfenton.com.invalid> wrote in message
news:Xn**********************************@127.0.0. 1...
Wayne Gillespie <be*****@NOhotmailSPAM.com.au> wrote in
news:p8********************************@4ax.com:
On Sun, 15 Jan 2006 01:32:00 -0000, "John"
<Jo**@nospam.infovis.co.uk> wrote:
I need to get the signature folder for the current folder such as;
"F:\Documents and Settings\Dave\Application
Data\Microsoft\Signatures\" except that instead of Dave I need the
correct name for the current user, s that my code works
generically regardless of who is logged in. Is there a way to do
that?


http://www.mvps.org/access/api/api0054.htm


Er, what's wrong with this?

Environ("USERPROFILE")

Lots less code, it seems to me.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

Jan 16 '06 #4

P: n/a
another way ... apropos to nothing

Option Explicit

' requires reference to shell32.dll

' the constants are just here for reference
' as intellisense doesn't show them

Private Const ssfALTSTARTUP As Byte = &H1D
Private Const ssfAPPDATA As Byte = &H1A
Private Const ssfBITBUCKET As Byte = &HA
Private Const ssfCOMMONALTSTARTUP As Byte = &H1E
Private Const ssfCOMMONAPPDATA As Byte = &H23
Private Const ssfCOMMONDESKTOPDIR As Byte = &H19
Private Const ssfCOMMONFAVORITES As Byte = &H1F
Private Const ssfCOMMONPROGRAMS As Byte = &H17
Private Const ssfCOMMONSTARTMENU As Byte = &H16
Private Const ssfCOMMONSTARTUP As Byte = &H18
Private Const ssfCONTROLS As Byte = &H3
Private Const ssfCOOKIES As Byte = &H21
Private Const ssfDESKTOP As Byte = &H0
Private Const ssfDESKTOPDIRECTORY As Byte = &H10
Private Const ssfDRIVES As Byte = &H11
Private Const ssfFAVORITES As Byte = &H6
Private Const ssfFONTS As Byte = &H14
Private Const ssfHISTORY As Byte = &H22
Private Const ssfINTERNETCACHE As Byte = &H20
Private Const ssfLOCALAPPDATA As Byte = &H1C
Private Const ssfMYPICTURES As Byte = &H27
Private Const ssfNETHOOD As Byte = &H13
Private Const ssfNETWORK As Byte = &H12
Private Const ssfPERSONAL As Byte = &H5
Private Const ssfPRINTERS As Byte = &H4
Private Const ssfPRINTHOOD As Byte = &H1B
Private Const ssfPROFILE As Byte = &H28
Private Const ssfPROGRAMFILES As Byte = &H26
Private Const ssfPROGRAMS As Byte = &H2
Private Const ssfRECENT As Byte = &H8
Private Const ssfSENDTO As Byte = &H9
Private Const ssfSTARTMENU As Byte = &HB
Private Const ssfSTARTUP As Byte = &H7
Private Const ssfSYSTEM As Byte = &H25
Private Const ssfTEMPLATES As Byte = &H15
Private Const ssfWINDOWS As Byte = &H24

Private Function GetASpecialFolder(ByVal SSF As Long) As String
Dim s As Shell
Dim f As Folder3
Set s = New Shell
Set f = s.NameSpace(SSF)
If Not f Is Nothing Then
GetASpecialFolder = String(260, vbNullChar)
With WizHook
.Key = 51488399
.FullPath f.Title, GetASpecialFolder
End With
End If
End Function

Sub test()
Debug.Print GetASpecialFolder(ssfBITBUCKET)
End Sub

Jan 16 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.