How do I determine the full path of the folder that contains 32-bit programs using VBA? It’s called “Program Files” on 32-bit Windows systems, but on 64-bit systems it’s called “Program Files (x86)”.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Environ will do the trick:
List of environment variables can be found here.
UPDATE: Based on the conversation I’ve had with Christian and based on my comments, I looked into this a little more.
I have two machines I tested on:
I ran the following statements in the immediate window:
Results
Machine 1:
Machine 2:
So, based on these limited findings, you may want to see the if ProgramW6432 has a value. If not, assume 32 bit and use ProgramFiles.
Conversely, you could use PROCESSOR_IDENTIFIER to determine x64 vs. x86 and do the same thing.
I wouldn’t say either way is foolproof but should get you on the right track.