View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Getting Info From Registry VBA

I have a module file that wraps up all the messy Windows API code into
nice neat and easy to use VBA functions. Download, unzip, and import
http://www.cpearson.com/Zips/modRegistry.zip. This will create a
module in your project named modRegistry.

It has functions for reading and writing registry keys and values as
well as a number of support functions. The specific function you want
to use is RegistryGetValue which returns an existing value from an
existing key. If the key or value is not found, the result is Null,
which is why the result is tested with IsNull and why RegVal must be a
Variant data type. For example,


Dim RegVal As Variant
RegVal = RegistryGetValue(HKLM, _
"SOFTWARE\Adobe\Acrobat Reader\9.0", "InstallPath")
If IsNull(RegVal) Then
Debug.Print "value not found"
Else
Debug.Print "value: " & CStr(RegVal)
End If


Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]





On Sun, 3 Jan 2010 19:43:20 -0000, "Paul W Smith"
wrote:

Can any advise me what VBA code I use to extract contents of the following
registry key?

HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\9.0\InstallPath

PWS