Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Getting Info From Registry VBA

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Getting Info From Registry VBA

In message of Sun, 3 Jan
2010 14:08:18 in microsoft.public.excel.programming, Chip Pearson
writes
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.


That might allow me to do something I don't know how to do yet.

I find that loading some pages in Internet Explorer takes an
unreasonable time when pictures are involved.

In IE8, one can manually control whether pictures are loaded in future
activations with Tools/Internet Options/Advanced/Show pictures - it is
one of the Multimedia checkboxes.

MY ? I infer that changes a registry entry or entries. Which one(s)?

I want to implement the following pseudo-code
Switch off pictures
Set ie = CreateObject("InternetExplorer.Application") ' start ie
Switch on pictures.

I tried using Procmon to identify the relevant data. There was more
noise than I wanted to wander through.

BTW:
I normally access ie from VBA without opening an ie window.
This can be painful if ie decides to be slow about loading pictures.
I use this code:

Dim Fired As Boolean

....

Private Sub MakeIEVisible()
Fired = True
ie.Visible = True
End Sub

Sub foo()
Dim IEalarm As Date

...
IEalarm = Now + TimeValue("00:00:15")
Fired = False
Application.OnTime IEalarm, "MakeIEVisible"
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate2 URL1
Do While ie.busy Or ie.ReadyState < 4: DoEvents: Loop
If Not Fired Then Application.OnTime IEalarm, "MakeIEVisible", schedule:=False
...
End Sub

Either the Internet access takes less than 15 seconds or an IE window is
opened, which allows me to use the "Esc" key to stop ie hanging about,
waiting for pictures I don't care about.
If I break that code in the debugger, IEAlarm is not called and the
schedule=False call fails. That is easily sorted by altering the next
statement to skip that call. There is probably a cleverer way to handle
running code in the debugger. This is clever enough for me. ;)
I could use onerror, but choose not to.
--
Walter Briscoe
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Getting Info From Registry VBA

In message of Thu, 7 Jan 2010
16:16:10 in microsoft.public.excel.programming, Walter Briscoe
writes
In message of Sun, 3 Jan
2010 14:08:18 in microsoft.public.excel.programming, Chip Pearson
writes
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.


That might allow me to do something I don't know how to do yet.

I find that loading some pages in Internet Explorer takes an
unreasonable time when pictures are involved.


I managed to find the relevant entry. I find that its value is read
every time Navigate2 is used. I now use code like this:

Dim Do As Object
Dim IE as Object
Dim RegVal As Variant

Private Sub awaitIE()
Do Until Not IE.busy And IE.ReadyState = 4: DoEvents: Loop
End Sub

Private Sub TxURL(ByVal URL1 As String)
Dim RegOK As Boolean

If IE Is Nothing Then
RegVal = RegistryGetValue(HKCU, _
"Software\Microsoft\Internet Explorer\Main", _
"Display Inline Images")
If RegVal < "no" Then RegOK = RegistryCreateValue(HKCU, _
"Software\Microsoft\Internet Explorer\Main", _
"Display Inline Images", "no")
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
End If

IE.Navigate2 URL1
awaitIE
Set Doc = IE.Document
End Sub

....
' I would like to have the following in an exit handler,
' but can't find that concept in VBA
Set IE = Nothing
If RegVal < 0 And RegVal < "no" _
Then RegOK = RegistryCreateValue(HKCU, _
"Software\Microsoft\Internet Explorer\Main", _
"Display Inline Images", RegVal)
End Sub

--
Walter Briscoe
Reply
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
Installing .xla add-in via the registry RB Smissaert Excel Programming 4 May 26th 05 06:50 AM
VBA Modify Registry Mary Excel Programming 1 February 18th 05 05:32 AM
Value from Registry Roy Lasris Excel Programming 3 February 23rd 04 11:53 PM
Registry Tom Ogilvy Excel Programming 1 July 16th 03 01:02 AM
Registry Patrick Molloy[_4_] Excel Programming 0 July 15th 03 12:45 PM


All times are GMT +1. The time now is 09:52 PM.

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

About Us

"It's about Microsoft Excel"