Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the boot drive letter with VBA 2

Status
Not open for further replies.

GVF

Programmer
Feb 25, 2005
160
US
I want to determine the boot drive so I can change drives and get to the "...Documents and Settings\All Users\Application Data\Microsoft" folder on any machine.

Is there a keyword in VBA (like %BootDrive%) that will point me to the correct drive letter? Or is there another way to accomplish this?

Thanks in Advance.
 
Use Environ function with number (returns argument name and value) or with named argument (only value is returned), test for the most convinient argument:
Environ("ALLUSERSPROFILE")
or:
Environ(1)

combo
 
Hi GVF,

combo's solution should help you, but please be aware that the Documents and Settings folder is not necessarily on the boot drive.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Thanks for the code clips. There are exactly what I was looking for. Stars to both.

Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top