This example determines whether the bookmark named "start" exists in the active document. If the bookmark exists, it's deleted.
If ActiveDocument.Bookmarks.Exists("start") = True Then
ActiveDocument.Bookmarks("start").Delete
End If
This example determines whether the Windows Calculator program is running (if the task exists). If Calculator isn't running, the Shell statement starts it. If Calculator is running, the application is activated.
If Tasks.Exists("Calculator") = False Then
Shell "Calc.exe"
Else
Tasks("Calculator").Activate
End If
Tasks("Calculator").WindowState = wdWindowStateNormal