LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Locating a user's Program Files

I use winXP.

For me,
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Pro gramFilesDir
contained a value of: C:\program files

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Pro gramFilesPath
contained a value of: %ProgramFiles%

which looks a lot like a way to refer to an environment variable.

Like using Windows start button|run
and typing:
%temp%
to get to the user's temp folder
%programfiles%
took me to my c:\program files folder.





Peter T wrote:

Hi Dave,

Do you know if this would work in the 9x series?

If sPath = "" Then
sPath = WSHShell.RegRead _
("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\P rogramFilesDir")
End If


Yes, that worked for me in W98SE when I ran your testme02 as posted earlier.

sPath = WSHShell.environment("Process")("ProgramFiles")
and
MsgBox Environ("programfiles")
both returned empty strings but without error.

FWIW, I notice that besides "ProgramFilesDir" I also have
"ProgramFilesPath", adjacent in the registry. Both show same path, as I
would expect but wonder why the two keys.

Regards,
Peter T


--

Dave Peterson
 
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
XLS Files Default Program Dan Excel Discussion (Misc queries) 1 February 11th 09 05:51 AM
Cannot open excel files unless from the program itself Pedro Setting up and Configuration of Excel 0 November 14th 07 11:41 AM
What program should i use for archived files? R Oconnor Excel Discussion (Misc queries) 2 January 12th 07 08:56 AM
XP Excel program changes all my files to not duplex as stored agridsl Setting up and Configuration of Excel 0 November 1st 05 07:02 PM
Program Files Folder Scott Gordon Excel Programming 0 May 5th 04 06:26 PM


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

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

About Us

"It's about Microsoft Excel"