Michael
Mon May 14 21:16:08 CDT 2007
On 14 May 2007 15:41:01 -0700, getkevin@... wrote in microsoft.public.scripting.vbscript:
>Well, no luck with your script. There is no 'end if' for the 'if
>objFSO..." line in your example so I added it to get past the first
>error, but it now complains about object required 'objFSO' for line 9
>(if objFSO....).
I suspect like Tom that there are underlying permissions issues. Tom's
code may have been mangled in that some one-liners have been wrapped -
a proper news reader wouldn't have; he also seems to be inconsistent
between "fso" and "objFSO" - easily enough corrected, see below.
>On May 14, 4:40 pm, Tom Lavedas <tglba...@cox.net> wrote:
>> Try this ...
>>
>> Dim fso, CitrixServer
>> blabla '; invokes the subroutine
>> MsgBox "Hello World " & CStr(CitrixServer)
>> Set fso = nothing
>>
>> sub blabla
>> Set fso = CreateObject("Scripting.FileSystemObject")
>> If objFSO.FileExists("C:\citrix.server") Then
>> CitrixServer = True
>> end sub
>>
>> I believe it will throw the original error.
01 Dim objFSO, CitrixServer
02 blabla(CitrixServer) '; invokes the subroutine
03 MsgBox "Hello World " & CStr(CitrixServer)
04 WScript.Quit
05
06 Sub blabla(blnBool)
07 Set objFSO = CreateObject("Scripting.FileSystemObject")
08 If objFSO.FileExists("C:\citrix.server") Then blnBool = True
09 End Sub
Line 08 could also be re-written as
08 blnBool = objFSO.FileExists("C:\citrix.server")
or lines 07 and 08 could be combined into one single line:
07 blnBool = CreateObject("Scripting.FileSystemObject").FileExists("C:\citrix.server")
In fact, the whole program can be written in one line (tested):
01 MsgBox "Hello World " & CreateObject("Scripting.FileSystemObject").FileExists("C:\citrix.server")
--
Michael Bednarek
http://mbednarek.com/ "POST NO BILLS"