home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Special / chip-cd_2001_spec_05.zip / spec_05 / ras.cab / listadapters.vbs < prev    next >
Text File  |  1999-11-04  |  23KB  |  672 lines

  1. '********************************************************************
  2. '*
  3. '* File:           ListAdapters.vbs
  4. '* Created:        March 1999
  5. '* Version:        1.0
  6. '*
  7. '*  Main Function:  Lists properties of all network adapters.
  8. '*
  9. '*  ListAdapters.vbs [/S <server>] [/U <username>] [/W <password>] 
  10. '*                   [/O <outputfile>]
  11. '*
  12. '* Copyright (C) 1999 Microsoft Corporation
  13. '*
  14. '********************************************************************
  15.  
  16. OPTION EXPLICIT
  17.  
  18.     'Define constants
  19.     CONST CONST_ERROR                   = 0
  20.     CONST CONST_WSCRIPT                 = 1
  21.     CONST CONST_CSCRIPT                 = 2
  22.     CONST CONST_SHOW_USAGE              = 3
  23.     CONST CONST_PROCEED                 = 4
  24.  
  25.     'Declare variables
  26.     Dim intOpMode, i
  27.     Dim strServer, strUserName, strPassword, strOutputFile
  28.  
  29.     'Make sure the host is csript, if not then abort
  30.     VerifyHostIsCscript()
  31.  
  32.     'Parse the command line
  33.     intOpMode = intParseCmdLine(strServer     ,  _
  34.                                 strUserName   ,  _
  35.                                 strPassword   ,  _
  36.                                 strOutputFile    )
  37.  
  38.  
  39.     Select Case intOpMode
  40.  
  41.         Case CONST_SHOW_USAGE
  42.             Call ShowUsage()
  43.  
  44.         Case CONST_PROCEED                 
  45.             Call ListAdapters(strServer     , _
  46.                               strOutputFile , _
  47.                               strUserName   , _
  48.                               strPassword     )
  49.  
  50.         Case CONST_ERROR
  51.             'Do Nothing
  52.  
  53.         Case Else                    'Default -- should never happen
  54.             Call Wscript.Echo("Error occurred in passing parameters.")
  55.  
  56.     End Select
  57.  
  58. '********************************************************************
  59. '* End of Script
  60. '********************************************************************
  61.  
  62. '********************************************************************
  63. '*
  64. '* Sub ListAdapters()
  65. '* Purpose: Lists properties of all network adapters.
  66. '* Input:   strServer           a machine name
  67. '*          strUserName         the current user's name
  68. '*          strPassword         the current user's password
  69. '* Output:  Results are either printed on screen or saved in strOutputFile.
  70. '*
  71. '********************************************************************
  72.  
  73. Private Sub ListAdapters(strServer     , _
  74.                          strOutputFile , _
  75.                          strUserName   , _
  76.                          strPassword     )
  77.  
  78.  
  79.     ON ERROR RESUME NEXT
  80.  
  81.     Dim objFileSystem, objOutputFile, objService, objEnumerator, objInstance
  82.     Dim strProperties(3)
  83.     Dim strQuery, strMessage, strTemp
  84.     Dim i, j
  85.     Dim blnEmpty
  86.  
  87.     strProperties(0) = "ServiceName"
  88.     strProperties(1) = "DhcpEnabled"                    
  89.     strProperties(2) = "Description"
  90.     strProperties(3) = "IPAddress"
  91.  
  92.     'Open a text file for output if the file is requested
  93.     If Not IsEmpty(strOutputFile) Then
  94.         If (NOT blnOpenFile(strOutputFile, objOutputFile)) Then
  95.             Call Wscript.Echo ("Could not open an output file.")
  96.             Exit Sub
  97.         End If
  98.     End If
  99.  
  100.     'Establish a connection with the server.
  101.     If blnConnect("root\cimv2" , _
  102.                    strUserName , _
  103.                    strPassword , _
  104.                    strServer   , _
  105.                    objService  ) Then
  106.         Call Wscript.Echo("")
  107.         Call Wscript.Echo("Please check the server name, " _
  108.                         & "credentials and WBEM Core.")
  109.         Exit Sub
  110.     End If
  111.  
  112.     'Set the query string.
  113.     strQuery = "Select "
  114.     For i = 0 To UBound(strProperties)-1
  115.         strQuery = strQuery & LCase(strProperties(i)) & ", "
  116.     Next
  117.     strQuery = strQuery & LCase(strProperties(i))
  118.     strQuery = strQuery & " From Win32_NetworkAdapterConfiguration"
  119.  
  120.     blnEmpty = False
  121.  
  122.     Set objEnumerator = objService.ExecQuery(strQuery,,0)
  123.     If Err.Number Then
  124.         Print "Error 0x" & CStr(Hex(Err.Number)) & " occurred during the query."
  125.         If Err.Description <> "" Then
  126.             Print "Error description: " & Err.Description & "."
  127.         End If
  128.         Err.Clear
  129.         Exit Sub
  130.     End If
  131.  
  132.     For Each objInstance in objEnumerator
  133.         For i = 0 To UBound(strProperties)
  134.             strMessage = UCase(strPackString(strProperties(i), 30, 1, 0))
  135.             strTemp = objInstance.properties_(strProperties(i))
  136.             If Err.Number Then
  137.                 Err.Clear
  138.             Else
  139.                 If IsArray(strTemp) Then
  140.                     If strTemp(0) = "" Then
  141.                         blnEmpty = True
  142.                     Else
  143.                         For j = 0 To UBound(strTemp)
  144.                             strMessage = strMessage & strTemp(j) & ", "
  145.                         Next
  146.                         strMessage = Left(strMessage, Len(strMessage)-2)
  147.                     End If
  148.                 Else
  149.                     If IsNull(strTemp) Then
  150.                         blnEmpty = True
  151.                     Else
  152.                         strTemp = CStr(strTemp)
  153.                         If strTemp = "" Then
  154.                             blnEmpty = True
  155.                         Else
  156.                             strMessage = strMessage & strTemp
  157.                         End If
  158.                     End If
  159.                 End If
  160.                 If blnEmpty Then
  161.                     blnEmpty = False
  162.                 Else
  163.                     WriteLine strMessage, objOutputFile
  164.                 End If
  165.             End If            
  166.         Next
  167.         WriteLine "", objOutputFile
  168.     Next
  169.  
  170.  
  171.     If IsObject(objOutputFile) Then
  172.         objOutputFile.Close
  173.         Call Wscript.Echo ("Results are saved in file " & strOutputFile & ".")
  174.     End If
  175.  
  176. End Sub
  177.  
  178. '********************************************************************
  179. '*
  180. '* Function intParseCmdLine()
  181. '*
  182. '* Purpose: Parses the command line.
  183. '* Input:   
  184. '*
  185. '* Output:  strServer         a remote server ("" = local server")
  186. '*          strUserName       the current user's name
  187. '*          strPassword       the current user's password
  188. '*          strOutputFile     an output file name
  189. '*
  190. '********************************************************************
  191. Private Function intParseCmdLine( ByRef strServer,        _
  192.                                   ByRef strUserName,      _
  193.                                   ByRef strPassword,      _
  194.                                   ByRef strOutputFile     )
  195.  
  196.  
  197.     ON ERROR RESUME NEXT
  198.  
  199.     Dim strFlag
  200.     Dim intState, intArgIter
  201.     Dim objFileSystem
  202.  
  203.     If Wscript.Arguments.Count > 0 Then
  204.         strFlag = Wscript.arguments.Item(0)
  205.     End If
  206.  
  207.     If IsEmpty(strFlag) Then                'No arguments have been received
  208.         intParseCmdLine = CONST_PROCEED
  209.         Exit Function
  210.     End If
  211.  
  212.     'Check if the user is asking for help or is just confused
  213.     If (strFlag="help") OR (strFlag="/h") OR (strFlag="\h") OR (strFlag="-h") _
  214.         OR (strFlag = "\?") OR (strFlag = "/?") OR (strFlag = "?") _ 
  215.         OR (strFlag="h") Then
  216.         intParseCmdLine = CONST_SHOW_USAGE
  217.         Exit Function
  218.     End If
  219.  
  220.     'Retrieve the command line and set appropriate variables
  221.      intArgIter = 0
  222.     Do While intArgIter <= Wscript.arguments.Count - 1
  223.         Select Case Left(LCase(Wscript.arguments.Item(intArgIter)),2)
  224.   
  225.             Case "/s"
  226.                 If Not blnGetArg("Server", strServer, intArgIter) Then
  227.                     intParseCmdLine = CONST_ERROR
  228.                     Exit Function
  229.                 End If
  230.                 intArgIter = intArgIter + 1
  231.  
  232.             Case "/o"
  233.                 If Not blnGetArg("Output File", strOutputFile, intArgIter) Then
  234.                     intParseCmdLine = CONST_ERROR
  235.                     Exit Function
  236.                 End If
  237.                 intArgIter = intArgIter + 1
  238.  
  239.             Case "/u"
  240.                 If Not blnGetArg("User Name", strUserName, intArgIter) Then
  241.                     intParseCmdLine = CONST_ERROR
  242.                     Exit Function
  243.                 End If
  244.                 intArgIter = intArgIter + 1
  245.  
  246.             Case "/w"
  247.                 If Not blnGetArg("User Password", strPassword, intArgIter) Then
  248.                     intParseCmdLine = CONST_ERROR
  249.                     Exit Function
  250.                 End If
  251.                 intArgIter = intArgIter + 1
  252.  
  253.             Case Else 'We shouldn't get here
  254.                 Call Wscript.Echo("Invalid or misplaced parameter: " _
  255.                    & Wscript.arguments.Item(intArgIter) & vbCRLF _
  256.                    & "Please check the input and try again," & vbCRLF _
  257.                    & "or invoke with '/?' for help with the syntax.")
  258.                 Wscript.Quit
  259.  
  260.         End Select
  261.  
  262.     Loop '** intArgIter <= Wscript.arguments.Count - 1
  263.  
  264.     If IsEmpty(intParseCmdLine) Then _
  265.         intParseCmdLine = CONST_PROCEED
  266.  
  267. End Function
  268.  
  269. '********************************************************************
  270. '*
  271. '* Sub ShowUsage()
  272. '*
  273. '* Purpose: Shows the correct usage to the user.
  274. '*
  275. '* Input:   None
  276. '*
  277. '* Output:  Help messages are displayed on screen.
  278. '*
  279. '********************************************************************
  280. Private Sub ShowUsage()
  281.  
  282.     Wscript.Echo ""
  283.     Wscript.Echo "Lists properties of all network adapters."
  284.     Wscript.Echo ""
  285.     Wscript.Echo "SYNTAX:"
  286.     Wscript.Echo "  ListAdapters.vbs [/S <server>] [/U <username>]" _
  287.                 &" [/W <password>]"
  288.     Wscript.Echo "  [/O <outputfile>]"
  289.     Wscript.Echo ""
  290.     Wscript.Echo "PARAMETER SPECIFIERS:"
  291.     Wscript.Echo "   server        A machine name."
  292.     Wscript.Echo "   username      The current user's name."
  293.     Wscript.Echo "   password      Password of the current user."
  294.     Wscript.Echo "   outputfile    The output file name."
  295.     Wscript.Echo ""
  296.     Wscript.Echo "EXAMPLE:"
  297.     Wscript.Echo "1. cscript ListAdapters.vbs"
  298.     Wscript.Echo "   List the network adapters on the local machine."
  299.     Wscript.Echo "2. cscript ListAdapters.vbs /S MyMachine2"
  300.     Wscript.Echo "   List the network adapters on the machine MyMachine2."
  301.  
  302. End Sub
  303.  
  304. '********************************************************************
  305. '* General Routines
  306. '********************************************************************
  307.  
  308. '********************************************************************
  309. '*
  310. '* Function strPackString()
  311. '*
  312. '* Purpose: Attaches spaces to a string to increase the length to intWidth.
  313. '*
  314. '* Input:   strString   a string
  315. '*          intWidth    the intended length of the string
  316. '*          blnAfter    Should spaces be added after the string?
  317. '*          blnTruncate specifies whether to truncate the string or not if
  318. '*                      the string length is longer than intWidth
  319. '*
  320. '* Output:  strPackString is returned as the packed string.
  321. '*
  322. '********************************************************************
  323. Private Function strPackString( ByVal strString, _
  324.                                 ByVal intWidth,  _
  325.                                 ByVal blnAfter,  _
  326.                                 ByVal blnTruncate)
  327.  
  328.     ON ERROR RESUME NEXT
  329.  
  330.     intWidth      = CInt(intWidth)
  331.     blnAfter      = CBool(blnAfter)
  332.     blnTruncate   = CBool(blnTruncate)
  333.  
  334.     If Err.Number Then
  335.         Call Wscript.Echo ("Argument type is incorrect!")
  336.         Err.Clear
  337.         Wscript.Quit
  338.     End If
  339.  
  340.     If IsNull(strString) Then
  341.         strPackString = "null" & Space(intWidth-4)
  342.         Exit Function
  343.     End If
  344.  
  345.     strString = CStr(strString)
  346.     If Err.Number Then
  347.         Call Wscript.Echo ("Argument type is incorrect!")
  348.         Err.Clear
  349.         Wscript.Quit
  350.     End If
  351.  
  352.     If intWidth > Len(strString) Then
  353.         If blnAfter Then
  354.             strPackString = strString & Space(intWidth-Len(strString))
  355.         Else
  356.             strPackString = Space(intWidth-Len(strString)) & strString & " "
  357.         End If
  358.     Else
  359.         If blnTruncate Then
  360.             strPackString = Left(strString, intWidth-1) & " "
  361.         Else
  362.             strPackString = strString & " "
  363.         End If
  364.     End If
  365.  
  366. End Function
  367.  
  368. '********************************************************************
  369. '* 
  370. '*  Function blnGetArg()
  371. '*
  372. '*  Purpose: Helper to intParseCmdLine()
  373. '* 
  374. '*  Usage:
  375. '*
  376. '*     Case "/s" 
  377. '*       blnGetArg ("server name", strServer, intArgIter)
  378. '*
  379. '********************************************************************
  380. Private Function blnGetArg ( ByVal StrVarName,   _
  381.                              ByRef strVar,       _
  382.                              ByRef intArgIter) 
  383.  
  384.     blnGetArg = False 'failure, changed to True upon successful completion
  385.  
  386.     If Len(Wscript.Arguments(intArgIter)) > 2 then
  387.         If Mid(Wscript.Arguments(intArgIter),3,1) = ":" then
  388.             If Len(Wscript.Arguments(intArgIter)) > 3 then
  389.                 strVar = Right(Wscript.Arguments(intArgIter), _
  390.                          Len(Wscript.Arguments(intArgIter)) - 3)
  391.                 blnGetArg = True
  392.                 Exit Function
  393.             Else
  394.                 intArgIter = intArgIter + 1
  395.                 If intArgIter > (Wscript.Arguments.Count - 1) Then
  396.                     Call Wscript.Echo( "Invalid " & StrVarName & ".")
  397.                     Call Wscript.Echo( "Please check the input and try again.")
  398.                     Exit Function
  399.                 End If
  400.  
  401.                 strVar = Wscript.Arguments.Item(intArgIter)
  402.                 If Err.Number Then
  403.                     Call Wscript.Echo( "Invalid " & StrVarName & ".")
  404.                     Call Wscript.Echo( "Please check the input and try again.")
  405.                     Exit Function
  406.                 End If
  407.  
  408.                 If InStr(strVar, "/") Then
  409.                     Call Wscript.Echo( "Invalid " & StrVarName)
  410.                     Call Wscript.Echo( "Please check the input and try again.")
  411.                     Exit Function
  412.                 End If
  413.  
  414.                 blnGetArg = True 'success
  415.             End If
  416.         Else
  417.             strVar = Right(Wscript.Arguments(intArgIter), _
  418.                      Len(Wscript.Arguments(intArgIter)) - 2)
  419.             blnGetArg = True 'success
  420.             Exit Function
  421.         End If
  422.     Else
  423.         intArgIter = intArgIter + 1
  424.         If intArgIter > (Wscript.Arguments.Count - 1) Then
  425.             Call Wscript.Echo( "Invalid " & StrVarName & ".")
  426.             Call Wscript.Echo( "Please check the input and try again.")
  427.             Exit Function
  428.         End If
  429.  
  430.         strVar = Wscript.Arguments.Item(intArgIter)
  431.         If Err.Number Then
  432.             Call Wscript.Echo( "Invalid " & StrVarName & ".")
  433.             Call Wscript.Echo( "Please check the input and try again.")
  434.             Exit Function
  435.         End If
  436.  
  437.         If InStr(strVar, "/") Then
  438.             Call Wscript.Echo( "Invalid " & StrVarName)
  439.             Call Wscript.Echo( "Please check the input and try again.")
  440.             Exit Function
  441.         End If
  442.         blnGetArg = True 'success
  443.     End If
  444. End Function
  445.  
  446. '********************************************************************
  447. '*
  448. '* Function blnConnect()
  449. '*
  450. '* Purpose: Connects to machine strServer.
  451. '*
  452. '* Input:   strServer       a machine name
  453. '*          strNameSpace    a namespace
  454. '*          strUserName     name of the current user
  455. '*          strPassword     password of the current user
  456. '*
  457. '* Output:  objService is returned  as a service object.
  458. '*          strServer is set to local host if left unspecified
  459. '*
  460. '********************************************************************
  461. Private Function blnConnect(ByVal strNameSpace, _
  462.                             ByVal strUserName,  _
  463.                             ByVal strPassword,  _
  464.                             ByRef strServer,    _
  465.                             ByRef objService)
  466.  
  467.     ON ERROR RESUME NEXT
  468.  
  469.     Dim objLocator, objWshNet
  470.  
  471.     blnConnect = False     'There is no error.
  472.  
  473.     'Create Locator object to connect to remote CIM object manager
  474.     Set objLocator = CreateObject("WbemScripting.SWbemLocator")
  475.     If Err.Number then
  476.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & _
  477.                            " occurred in creating a locator object." )
  478.         If Err.Description <> "" Then
  479.             Call Wscript.Echo( "Error description: " & Err.Description & "." )
  480.         End If
  481.         Err.Clear
  482.         blnConnect = True     'An error occurred
  483.         Exit Function
  484.     End If
  485.  
  486.     'Connect to the namespace which is either local or remote
  487.     Set objService = objLocator.ConnectServer (strServer, strNameSpace, _
  488.        strUserName, strPassword)
  489.     ObjService.Security_.impersonationlevel = 3
  490.     If Err.Number then
  491.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & _
  492.                            " occurred in connecting to server " _
  493.            & strServer & ".")
  494.         If Err.Description <> "" Then
  495.             Call Wscript.Echo( "Error description: " & Err.Description & "." )
  496.         End If
  497.         Err.Clear
  498.         blnConnect = True     'An error occurred
  499.     End If
  500.  
  501.     'Get the current server's name if left unspecified
  502.     If IsEmpty(strServer) Then
  503.         Set objWshNet = CreateObject("Wscript.Network")
  504.     strServer     = objWshNet.ComputerName
  505.     End If
  506.  
  507. End Function
  508.  
  509. '********************************************************************
  510. '*
  511. '* Sub      VerifyHostIsCscript()
  512. '*
  513. '* Purpose: Determines which program is used to run this script.
  514. '*
  515. '* Input:   None
  516. '*
  517. '* Output:  If host is not cscript, then an error message is printed 
  518. '*          and the script is aborted.
  519. '*
  520. '********************************************************************
  521. Sub VerifyHostIsCscript()
  522.  
  523.     ON ERROR RESUME NEXT
  524.  
  525.     Dim strFullName, strCommand, i, j, intStatus
  526.  
  527.     strFullName = WScript.FullName
  528.  
  529.     If Err.Number then
  530.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & " occurred." )
  531.         If Err.Description <> "" Then
  532.             Call Wscript.Echo( "Error description: " & Err.Description & "." )
  533.         End If
  534.         intStatus =  CONST_ERROR
  535.     End If
  536.  
  537.     i = InStr(1, strFullName, ".exe", 1)
  538.     If i = 0 Then
  539.         intStatus =  CONST_ERROR
  540.     Else
  541.         j = InStrRev(strFullName, "\", i, 1)
  542.         If j = 0 Then
  543.             intStatus =  CONST_ERROR
  544.         Else
  545.             strCommand = Mid(strFullName, j+1, i-j-1)
  546.             Select Case LCase(strCommand)
  547.                 Case "cscript"
  548.                     intStatus = CONST_CSCRIPT
  549.                 Case "wscript"
  550.                     intStatus = CONST_WSCRIPT
  551.                 Case Else       'should never happen
  552.                     Call Wscript.Echo( "An unexpected program was used to " _
  553.                                        & "run this script." )
  554.                     Call Wscript.Echo( "Only CScript.Exe or WScript.Exe can " _
  555.                                        & "be used to run this script." )
  556.                     intStatus = CONST_ERROR
  557.                 End Select
  558.         End If
  559.     End If
  560.  
  561.     If intStatus <> CONST_CSCRIPT Then
  562.         Call WScript.Echo( "Please run this script using CScript." & vbCRLF & _
  563.              "This can be achieved by" & vbCRLF & _
  564.              "1. Using ""CScript ListAdapters.vbs arguments"" for Windows 95/98 or" _
  565.              & vbCRLF & "2. Changing the default Windows Scripting Host " _
  566.              & "setting to CScript" & vbCRLF & "    using ""CScript " _
  567.              & "//H:CScript //S"" and running the script using" & vbCRLF & _
  568.              "    ""ListAdapters.vbs arguments"" for Windows NT/2000." )
  569.         WScript.Quit
  570.     End If
  571.  
  572. End Sub
  573.  
  574. '********************************************************************
  575. '*
  576. '* Sub WriteLine()
  577. '* Purpose: Writes a text line either to a file or on screen.
  578. '* Input:   strMessage  the string to print
  579. '*          objFile     an output file object
  580. '* Output:  strMessage is either displayed on screen or written to a file.
  581. '*
  582. '********************************************************************
  583. Sub WriteLine(ByVal strMessage, ByVal objFile)
  584.  
  585.     On Error Resume Next
  586.     If IsObject(objFile) then        'objFile should be a file object
  587.         objFile.WriteLine strMessage
  588.     Else
  589.         Call Wscript.Echo( strMessage )
  590.     End If
  591.  
  592. End Sub
  593.  
  594. '********************************************************************
  595. '* 
  596. '* Function blnErrorOccurred()
  597. '*
  598. '* Purpose: Reports error with a string saying what the error occurred in.
  599. '*
  600. '* Input:   strIn        string saying what the error occurred in.
  601. '*
  602. '* Output:  displayed on screen 
  603. '* 
  604. '********************************************************************
  605. Private Function blnErrorOccurred (ByVal strIn)
  606.  
  607.     If Err.Number Then
  608.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & ": " & strIn)
  609.         If Err.Description <> "" Then
  610.             Call Wscript.Echo( "Error description: " & Err.Description)
  611.         End If
  612.         Err.Clear
  613.         blnErrorOccurred = True
  614.     Else
  615.         blnErrorOccurred = False
  616.     End If
  617.  
  618. End Function
  619.  
  620. '********************************************************************
  621. '* 
  622. '* Function blnOpenFile
  623. '*
  624. '* Purpose: Opens a file.
  625. '*
  626. '* Input:   strFileName        A string with the name of the file.
  627. '*
  628. '* Output:  Sets objOpenFile to a FileSystemObject and setis it to 
  629. '*            Nothing upon Failure.
  630. '* 
  631. '********************************************************************
  632. Private Function blnOpenFile(ByVal strFileName, ByRef objOpenFile)
  633.  
  634.     ON ERROR RESUME NEXT
  635.  
  636.     Dim objFileSystem
  637.  
  638.     Set objFileSystem = Nothing
  639.  
  640.     If IsEmpty(strFileName) OR strFileName = "" Then
  641.         blnOpenFile = False
  642.         Set objOpenFile = Nothing
  643.         Exit Function
  644.     End If
  645.  
  646.     'Create a file object
  647.     Set objFileSystem = CreateObject("Scripting.FileSystemObject")
  648.     If blnErrorOccurred("Could not create filesystem object.") Then
  649.         blnOpenFile = False
  650.         Set objOpenFile = Nothing
  651.         Exit Function
  652.     End If
  653.  
  654.     'Open the file for output
  655.     Set objOpenFile = objFileSystem.OpenTextFile(strFileName, 8, True)
  656.     If blnErrorOccurred("Could not open") Then
  657.         blnOpenFile = False
  658.         Set objOpenFile = Nothing
  659.         Exit Function
  660.     End If
  661.     blnOpenFile = True
  662.  
  663. End Function
  664.  
  665. '********************************************************************
  666. '*                                                                  *
  667. '*                           End of File                            *
  668. '*                                                                  *
  669. '********************************************************************
  670.  
  671.  
  672.