wie bekommt man mittels VBA heraus wo sich das Verzeichnis "Eigene Dateien" befindet?
Manche Anwender haben ja ihr Homeverzeichnis nach 'irgendwohin' verschoben.
Liebe Grüße
Vera
Option Explicit
Private Declare Function SHGetFolderPath Lib "shfolder" Alias "SHGetFolderPathA" _
(ByVal hWndOwner As Long, _
ByVal Folder As Long, _
ByVal hToken As Long, _
ByVal Flags As Long, _
ByVal strPath As String) As Long
Private Const SHGFP_TYPE_CURRENT As Long = 0&
Private Const MAX_PATH As Long = 260&
Public Enum CSIDLS
CSIDL_PERSONAL = &H5&
End Enum
Public Sub Eigene()
MsgBox GetSpecialFolder(CSIDL_PERSONAL)
End Sub
Public Function GetSpecialFolder(ByVal CSIDL As CSIDLS) As String
Dim sPath As String
Dim RetVal As Long
Dim lFlags As Long
sPath = Space$(MAX_PATH)
lFlags = CSIDL
RetVal = SHGetFolderPath(0, lFlags, 0, SHGFP_TYPE_CURRENT, sPath)
GetSpecialFolder = Left$(sPath, InStr(1, sPath, vbNullChar) - 1)
End Function