reference a system path in VBA module

S

Sean Moore

HI,

I had some code which kicked off explorer.exe from within a public module;
it involved invoking the Shell function with the string
c:\windows\explorer.exe. This hard coded reference to the path errored when
used on a WindowsNT machine in which the path needed to be
c:\winnt\explorer.exe.

I am sure there is a way to use one code segment which will reference the
system path to explorer.exe, but I do not know how to do this. Can anyone
shed light in my dimly lit arena?
 
E

Ed Jobe

That file is located in the os's sytem dir. You can use the environment
variable %winddir%.

Shell %windir% & "explore.exe"
 
E

Ed Jobe

Oops. That should be
Shell Environ("WinDir") & "\explorer.exe"
or
Shell Environ("SystemRoot") & "\explorer.exe"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top