Solved

Get windows system directory

Posted on 2004-05-03
3
420 Views
Last Modified: 2012-08-14
How can I retrieve the Windows root directory or the system32 directory?
I've been looking for an API GetSystemRoot or GetWindowsRoot or something like that with no result...
0
Comment
Question by:boeman
  • 2
3 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 10975450
Try:
environ("windir")
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 125 total points
ID: 10975457
Or

Option Explicit
Private Declare Function GetSystemDirectory Lib "KERNEL32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Private Sub Command1_Click()
    Dim strBuf As String

    strBuf = Space$(255)
    GetSystemDirectory strBuf, 255
    strBuf = Left$(strBuf, InStr(strBuf, Chr$(0)) - 1)
    Debug.Print strBuf
End Sub
0
 
LVL 3

Author Comment

by:boeman
ID: 10975535
muchos gracias
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VBA Check for Character 9 71
VB6 convert MSHFlexgrid1 cells 7 52
VBA filters 2 39
Access 2013 combo box not working 3 26
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now