Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default identify drive letter

Is it possible to find the path of the windows folder when excel first runs
using vba?



  #2   Report Post  
Posted to microsoft.public.excel.programming
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?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save workbook To any USB Drive no matter what drive letter pano[_3_] Excel Programming 9 July 15th 08 09:41 AM
Import from MS Access - Lose the drive letter..link only to drive Cyhill Excel Programming 6 September 17th 07 06:42 PM
Obtain drive letter assignment of CD/DVD drive? EagleOne Excel Discussion (Misc queries) 1 October 13th 06 01:27 PM
Identify Load Drive Brian C Excel Programming 7 September 30th 05 10:42 PM
Identify CD-Rom drive MD Excel Programming 5 August 24th 04 03:32 PM


All times are GMT +1. The time now is 09:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"