View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default identify drive letter

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

--
Rick (MVP - Excel)


"sunilpatel" wrote in message
...
Is it possible to find the path of the windows folder when excel first
runs using vba?