Getting the user profile folder

  • Thread starter Thread starter John
  • Start date Start date
J

John

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
 
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
 
Nothing.

Knowing how to get a handle to all the special folders is very useful
though.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top