Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Finding Boot Drive

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gary Hillerson - 11 Nov 2004 02:31 GMT
Is there a function for finding the boot drive from within VBA that
will work will with Word '97 and later for Windows '98 or later?

I have an installer that installs an INI file in the Windows directory
on the user's system, which may or may not be on the C: drive. When my
template opens, I need to read that INI file, but I'm not sure how to
know the drive to use.

Thanks  in advance,
   gary
Jonathan West - 11 Nov 2004 13:43 GMT
> Is there a function for finding the boot drive from within VBA that
> will work will with Word '97 and later for Windows '98 or later?
[quoted text clipped - 5 lines]
>
> Thanks  in advance,

Place the following code into a separate module

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

Function WindowsFolder()
 Dim strWin As String
 strWin = Space(256)
 GetWindowsDirectory strWin, Len(strWin)
 WindowsFolder = Left$(strWin, InStr(strWin, Chr$(0)))
End Function

The WindowsFolder function returns the pathname of the windows folder.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

Gary Hillerson - 11 Nov 2004 17:23 GMT
Wow! Works perfectly.

Thanks

Gary

>Place the following code into a separate module
>
[quoted text clipped - 10 lines]
>
>The WindowsFolder function returns the pathname of the windows folder.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.