Posted to microsoft.public.word.mailmerge.fields
|
|
INCLUDETEXT
Cold I could do without, but a few weeks of rain would be more than welcome
--
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
macropod wrote:
too hot and humid here to provide the inclination to go out on an
August Saturday afternoon
Ah, what a difference a hemisphere makes. I'm staying inside 'cause
it's too cold to stay outside.
"Graham Mayor" wrote in message
...
macropod wrote:
If you're using vba in
your main mailmerge document, this opens up the possibility of
setting/resetting the key just for the duration of the mailmerge.
Having opened up that possibility and given that it is too hot and
humid here to provide the inclination to go out on an August Saturday
afternoon - how about
Sub ToggleSQLSecurity()
Dim WSHShell, RegKey, rKeyWord, wVer
Set WSHShell = CreateObject("WScript.Shell")
wVer = Application.Version
If wVer 10 Then
MsgBox "This macro is for Word 2002 and later!", vbOKOnly, "Wrong
Word Version"
Exit Sub
End If
Start:
RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\" & wVer &
"\Word\Options\"
On Error Resume Next 'The registry key does not exist
rKeyWord = WSHShell.RegRead(RegKey & "SQLSecurityCheck")
If rKeyWord = "" Then 'if the added key has no number
WSHShell.regwrite RegKey & "SQLSecurityCheck", 1, "REG_DWORD"
'set it at zero
GoTo Start: 'and read it again
End If
If rKeyWord = 1 Then
WSHShell.regwrite RegKey & "SQLSecurityCheck", 0, "REG_DWORD"
Else
WSHShell.regwrite RegKey & "SQLSecurityCheck", 1, "REG_DWORD"
End If
End Sub
This will create and/or toggle the SQL Security Check registry key
and will work with any Word version
--
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
|