Code: Select all
Function MyVBScriptCA()
Dim sKey, bFound, Button
Set WshShell = WScript.CreateObject("WScript.Shell")
sKey = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ONLYOFFICE Desktop Editors_is1\UninstallString")
with CreateObject("WScript.Shell")
Err.Clear
' turn off error trapping
Set WshShell = WScript.CreateObject("WScript.Shell")
Button = MsgBox("The previous version of {#sAppName} detected, please click 'OK' button to uninstall it, or 'Cancel' to quit setup.",1,"Error")
If Button = 1 Then
MsgBox "Ok"
WshShell.Run(sKey)
End If
If Button = 2 Then
MsgBox "Cancel"
'a = 1 / 0
Exit Function
On Error GoTo 0
return Error
End If ' test for success
' restore error trapping
end with
End Function
MyVBScriptCA()