D
Digga
Hi
I've posted this question over on the Outlook discussion group and have been
advised to try and use something like the wm_settingchange as this maybe the
only way, however, I'm unable to implement this as I really don't have a clue
and after reading about this, I'm not sure it would do it anyway.
The Problem>>
I have a piece of VBA code in Outlook to make setting changes to the
registry using the Windows API utilising RegOpenKeyEx, RegQueryValueEx,
RegCloseKey and RegSetValueEx functions, this works fine.
It appears that Outlook stores the registry settings on initilisation and
are not updated when making changes to it's registry settings. I need to know
how I can force Outlook to update it's stored registry setting for the key
that has been changed.
Is it possible to do this? If you make the change in Outlook, then the
changes are applied when you hit the OK button. I've posted the procedure
below that's making the registry changes.
Thanks in advance, all suggestion regarding this problem or the code are
welcome.
Regards,
Digga
The Procedure>>
Sub dhMarkComments()
Dim hKeyMarkComments As Long
Dim lngResult As Long
Dim lngBuffer As Long
Dim cb As Long
'Open the
HKCU\Software\Microsoft\Office\11.0\Common\MailSettings\MarkComments key
lngResult = RegOpenKeyEx(dhcHKeyCurrentUser,
"Software\Microsoft\Office\11.0\Common\MailSettings", 0&, dhcKeyAllAccess,
hKeyMarkComments)
'Make sure the call succeeded
If lngResult = dhcSuccess Then
'Create the buffer
'lngBuffer = Space(255)
cb = Len(lngBuffer)
'Read the Mark Comments value
lngResult = RegQueryValueEx(hKeyMarkComments, "MarkComments", 0&,
dhcRegDWord, lngBuffer, cb)
'Check return value
If lngResult = dhcSuccess Then
'Set new value
If lngBuffer = 0 Then
lngBuffer = 1
lngResult = RegSetValueEx(hKeyMarkComments, "MarkComments",
0&, dhcRegDWord, lngBuffer, cb)
MsgBox "Mark Comments changed to: " & lngBuffer
ElseIf lngBuffer = 1 Then
lngBuffer = 0
lngResult = RegSetValueEx(hKeyMarkComments, "MarkComments",
0&, dhcRegDWord, lngBuffer, cb)
MsgBox "Mark Comments changed to: " & lngBuffer
End If
End If
'Close the Mark Comments key
lngResult = RegCloseKey(hKeyMarkComments)
End If
End Sub
I've posted this question over on the Outlook discussion group and have been
advised to try and use something like the wm_settingchange as this maybe the
only way, however, I'm unable to implement this as I really don't have a clue
and after reading about this, I'm not sure it would do it anyway.
The Problem>>
I have a piece of VBA code in Outlook to make setting changes to the
registry using the Windows API utilising RegOpenKeyEx, RegQueryValueEx,
RegCloseKey and RegSetValueEx functions, this works fine.
It appears that Outlook stores the registry settings on initilisation and
are not updated when making changes to it's registry settings. I need to know
how I can force Outlook to update it's stored registry setting for the key
that has been changed.
Is it possible to do this? If you make the change in Outlook, then the
changes are applied when you hit the OK button. I've posted the procedure
below that's making the registry changes.
Thanks in advance, all suggestion regarding this problem or the code are
welcome.
Regards,
Digga
The Procedure>>
Sub dhMarkComments()
Dim hKeyMarkComments As Long
Dim lngResult As Long
Dim lngBuffer As Long
Dim cb As Long
'Open the
HKCU\Software\Microsoft\Office\11.0\Common\MailSettings\MarkComments key
lngResult = RegOpenKeyEx(dhcHKeyCurrentUser,
"Software\Microsoft\Office\11.0\Common\MailSettings", 0&, dhcKeyAllAccess,
hKeyMarkComments)
'Make sure the call succeeded
If lngResult = dhcSuccess Then
'Create the buffer
'lngBuffer = Space(255)
cb = Len(lngBuffer)
'Read the Mark Comments value
lngResult = RegQueryValueEx(hKeyMarkComments, "MarkComments", 0&,
dhcRegDWord, lngBuffer, cb)
'Check return value
If lngResult = dhcSuccess Then
'Set new value
If lngBuffer = 0 Then
lngBuffer = 1
lngResult = RegSetValueEx(hKeyMarkComments, "MarkComments",
0&, dhcRegDWord, lngBuffer, cb)
MsgBox "Mark Comments changed to: " & lngBuffer
ElseIf lngBuffer = 1 Then
lngBuffer = 0
lngResult = RegSetValueEx(hKeyMarkComments, "MarkComments",
0&, dhcRegDWord, lngBuffer, cb)
MsgBox "Mark Comments changed to: " & lngBuffer
End If
End If
'Close the Mark Comments key
lngResult = RegCloseKey(hKeyMarkComments)
End If
End Sub