
Option Explicit
'// This Sub creates a registry key for
'// HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Excel\Options
'// Creates Ref to Windows Script Host Object Model
'// C:\WINDOWS\SYSTEM\WSHOM.OCX
Const strKey As String = "HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Excel\Options\UndoHistory"
Const strType As String = "REG_DWORD"
Const dVal = 16 ' Change this NB: > 100 Not recomended by Microsoft
Sub ChangeXlUndoHistory()
Dim objWSH As Object
Set objWSH = CreateObject("WScript.Shell")
objWSH.RegWrite strKey, dVal, strType
Set objWSH = Nothing
MsgBox ReadRegEdit(strKey)
End Sub
'// To Read a Key
Function ReadRegEdit(key)
Dim Ws, Tmp
Set Ws = CreateObject("WScript.Shell")
Tmp = Ws.RegRead(key)
If Tmp = "" Then
ReadRegEdit = ""
Else
ReadRegEdit = Tmp
End If
Set Ws = Nothing
End Function