Forcing Application to Read Registry Change

G

Guest

Hi All

Got a bit of a problem here, I've written this code below to make changes to
registry key 'Mark Comments With' e-mail option in Outlook. Without closing
and reopening Outlook, the new value isn't recognised by Outlook when the
change to the registry is done using this code, whereas when the change is
made using the Tools|Options menu, the change is made and Outlook applies the
change straight away.

So my question is this, is it possible to make this registry value change
and have Outlook apply the change immediately using VBA?

Thanks in advance,

Digga

Code below:

Sub MarkComments()

Dim WshShell, regKey
Set WshShell = CreateObject("WScript.Shell")

regKey =
WshShell.RegRead("HKCU\Software\Microsoft\Office\11.0\Common\MailSettings\MarkComments")

If regKey = "0" Then
WshShell.RegWrite
"HKCU\Software\Microsoft\Office\11.0\Common\MailSettings\MarkComments", "1",
"REG_DWORD"
MsgBox "Mark Comments Value - set to TRUE"
End If

If regKey = "1" Then
WshShell.RegWrite
"HKCU\Software\Microsoft\Office\11.0\Common\MailSettings\MarkComments", "0",
"REG_DWORD"
MsgBox "Mark Comments Value - set to FALSE"
End If

Set WshShell = Nothing
Set regKey = Nothing

End Sub
 
M

Michael Bauer

Hi Digga,

googled for "send notify change registry", I found this site:

http://www.oreilly.com/catalog/winreg/chapter/ch04ex.html

It contains a lot of maybe useful keywords, e.g. "wm_wininichange",

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/wm_wininichange.asp


As I´ve understand so far, an application maybe ignores the message
indicating registry changes. So my answer to you is not a solution, but
maybe a good starting point for your further investigations and tests.
 
G

Guest

Hi Michael

Thank you very much for the links, they've got me thinking I can tell you.

If anyone else has any information to add or suggestions, I'd very much
appreciate it.

Thanks again Michael,

Digga
 

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