From: Michael Larsen on
Hi

I have a number of .vbs files in the following format:

C1.vbs:
Option Explict

Class clsC1

End Class

I can include these files in a .wsf file like this:
<package>
<job>
<script language="VBScript" src="C1.vbs"/>
<script language="VBScript" src="C2.vbs"/>
</job>
</package>

I also want to include the same files in an .asp file like this:
<script language="VBScript" runat="SERVER" src="C1.vbs"></script>
<script language="VBScript" runat="SERVER" src="C2.vbs"></script>

However, this fails because of the repeated Option Explicit Statements. I
can remove each Option Explicit statement from the .vbs files and add <%
Option Explicit%> to the .asp file, but then Option Explicit is not working
in the .wsf file.

Is there a way that I can include the same .vbs files in a .wsf and .asp
file and having Option Explicit working in both?

Regards,

Michael Larsen

From: Bob Barrows on
Michael Larsen wrote:
> Hi
> Is there a way that I can include the same .vbs files in a .wsf and
> .asp file and having Option Explicit working in both?
>
No

--
HTH,
Bob Barrows


From: Al Dunbar on


"Bob Barrows" <reb01501(a)NOyahoo.SPAMcom> wrote in message
news:OGgFSU7uKHA.796(a)TK2MSFTNGP05.phx.gbl...
> Michael Larsen wrote:
>> Hi
>> Is there a way that I can include the same .vbs files in a .wsf and
>> .asp file and having Option Explicit working in both?
>>
> No

But why would you need option explicit? If you are including code to define
classes, presumably you would have debugged them individually. Once free of
the bugs of spelling a variable name incorrectly or using an undefined
variable, option explicit is not doing anything for you. I'd say just leave
it out.

Of course, if your code is executing code built at run-time, you might
require option explicit.

/Al


From: Bob Barrows on
Al Dunbar wrote:
> "Bob Barrows" <reb01501(a)NOyahoo.SPAMcom> wrote in message
> news:OGgFSU7uKHA.796(a)TK2MSFTNGP05.phx.gbl...
>> Michael Larsen wrote:
>>> Hi
>>> Is there a way that I can include the same .vbs files in a .wsf and
>>> .asp file and having Option Explicit working in both?
>>>
>> No
>
> But why would you need option explicit?

Ummmm ... I don't know. You'll need to ask the OP. :-)
Or is this one of the cases where your newsreader failed to pick up the
original post, forcing you to reply to me?

But it is a valid question. Oprion Explicit is only really needed while the
code is being written and debugged, as you say.

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


From: Paul Randall on

"Bob Barrows" <reb01501(a)NOyahoo.SPAMcom> wrote in message
news:eojoyXGvKHA.3896(a)TK2MSFTNGP02.phx.gbl...
> Al Dunbar wrote:
>> "Bob Barrows" <reb01501(a)NOyahoo.SPAMcom> wrote in message
>> news:OGgFSU7uKHA.796(a)TK2MSFTNGP05.phx.gbl...
>>> Michael Larsen wrote:
>>>> Hi
>>>> Is there a way that I can include the same .vbs files in a .wsf and
>>>> .asp file and having Option Explicit working in both?
>>>>
>>> No
>>
>> But why would you need option explicit?
>
> Ummmm ... I don't know. You'll need to ask the OP. :-)
> Or is this one of the cases where your newsreader failed to pick up the
> original post, forcing you to reply to me?
>
> But it is a valid question. Oprion Explicit is only really needed while
> the code is being written and debugged, as you say.

Ummmm ... I don't know. I'm thinking that Option Explicit is really needed
as long as the possibility exists that it may catch an error. I suppose it
is no longer needed then the code is retired.

-Paul Randall