identify drive letter

  • Thread starter Thread starter sunilpatel
  • Start date Start date
S

sunilpatel

Is it possible to find the path of the windows folder when excel first runs
using vba?
 
Not sure what your question has to do with the subject of your posting, but
here is how to get the path for the Windows folder. Put this code in a
Module...

Private Declare Function GetWindowsDirectory Lib "kernel32" _
Alias "GetWindowsDirectoryA" _
(ByVal lpBuffer As String, _
ByVal nSize As Long) As Long

Public Function WindowsPath() As String
Dim Buffer As String * 260
GetWindowsDirectory Buffer, 260
WindowsPath = Left(Buffer, InStr(Buffer, Chr(0)) - 1)
End Function

and then call it from anywhere within your own code to get the Windows
folder; for example...

MsgBox WindowsPath
 
Back
Top