Function GETENV(variableName)
	
	Set objShell 		= WScript.CreateObject("WScript.Shell")
	Set theVariable 	= objShell.Environment("PROCESS")
	GETENV 			= theVariable(variableName)
	Set objShell 		= Nothing

end Function

Function GETAPP(applicationName)

	On Error Resume Next
	Set GETAPP		 = GetObject(, applicationName)
	If Err.Number <> 0 Then
		Set GETAPP 	= CreateObject(applicationName) 
	End If
	On Error GoTo 0

end Function

Set objExcelApplication	= GETAPP("Excel.Application")
Set theWorkbook			= objExcelApplication.Workbooks(GETENV("XCEL_WORKBOOK_NAME"))
Set theSheet			= theWorkbook.Sheets(GETENV("XCEL_SHEET_NAME"))

Dim theSheetName
theSheetName		= "=" & theSheet.Name & "!"

For n = 1 to theWorkbook.Names.Count
'On Error GoTo 0
On Error Resume Next
	' InStr([startpos, ]string1, string2[, compare]) - http://support.smartbear.com/viewarticle/28327/
	If InStr(theWorkbook.Names(n).RefersTo, theSheetName)=1 Then
		WScript.StdOut.Write theWorkbook.Names(n).RefersTo & vbTab & theWorkbook.Names(n).Name
		If n < theWorkbook.Names.Count Then
			WScript.StdOut.Write vbCr
		End If
	End If
Next 
