This is the example, a shortcut was installed to this code
:
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' $Header: C:/DBAREIS/Projects.PVCS/Win32/ScriptingTipsAndTricks/EXAMPLE[vbs].MkObject() [Create COM Object with Error Checking].vbs.txt.pvcs 1.0 29 Jun 2014 12:51:22 USER "Dennis" $
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
...
dim oShell : set oShell = MkObject("WScript.Shell")
dim oFS : set oFS = MkObject("Scripting.FileSystemObject")
...
set oShell = Nothing
set oFS = Nothing
'=========================================================================
function MkObject(ByVal AutomationClass) 'Version 14.152a
'=========================================================================
on error resume next
set MkObject = wscript.CreateObject(AutomationClass)
VbsCheck "Loading the automation class """ & AutomationClass & """." & " Reason 0x" & hex(err.number) & " - " & err.description
end function
'============================================================================
sub VbsCheck(ByVal DoingText)
'============================================================================
if err.number <> 0 then
Die "FAILED: " & DoingText & " Reason 0x" & hex(err.number) & " - " & err.description
end if
end sub