I've tried to use Option Explicit but don't know where to put this line of
code. I've check through the docs on COM and could not find any reference
that one can use option explicit in COM.

any ideas?

cheers
jk

Re: Can one use Option Explicit in COM? by Alex

Alex
Tue Mar 02 06:24:53 CST 2004

What do you eman when you say "in COM"?

Option Explicit is a statement used in VBScript; in VBScript, it should be
the first executable line of code.

Jacques Koorts wrote:
> I've tried to use Option Explicit but don't know where to put this line
> of code. I've check through the docs on COM and could not find any
> reference that one can use option explicit in COM.
>
> any ideas?
>
> cheers
> jk



Re: Can one use Option Explicit in COM? by Chris

Chris
Tue Mar 02 06:41:35 CST 2004

Option Explicit is a statement specific to VBScript and Visual Basic (I
presume you mean a VB ActiveXDLL component). It should be the first line of
a class, module or form code to be applied.
Option Explicit is used at compile time to ensure that all variables have
been declared. If not then the compilation will fail with an error.

Chris.

"Jacques Koorts" <jkoorts@ccalimited.com> wrote in message
news:1048t07i1967oc6@corp.supernews.com...
I've tried to use Option Explicit but don't know where to put this line of
code. I've check through the docs on COM and could not find any reference
that one can use option explicit in COM.

any ideas?

cheers
jk




Re: Can one use Option Explicit in COM? by Joe

Joe
Tue Mar 02 09:22:08 CST 2004

Hi,

"Jacques Koorts" <jkoorts@ccalimited.com> wrote in message
news:1048t07i1967oc6@corp.supernews.com...
> I've tried to use Option Explicit but don't know where to put this line of
> code. I've check through the docs on COM and could not find any reference
> that one can use option explicit in COM.
>
> any ideas?

From your prior posts, I assume that, by "COM" you mean WSC. If not, then
disregard this response. If so, the answer is yes. You can put it at the
start of the global code for each component. If this is what you mean, then
for future reference, refer to WSC files or, more generally, to classes or
XML encoding. COM can be any type of code that results in a standalone
accessible component.

Joe Earnest



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.564 / Virus Database: 356 - Release Date: 01-19-04



Re: Can one use Option Explicit in COM? by Jacques

Jacques
Tue Mar 02 11:20:38 CST 2004

Hi,

Yes sorry I forgot to mention that it was COM for WSC.

I tried for example:

function GetIP(strComputerName)

Option Explicit

GetIP = strComputerName

end function

but got the error "expected statement" on trying to register the COM. the
error occurs on the line "Option Explicit".

I'm using primalscript.

How now?

cheers
jk


"Joe Earnest" <joeearnestNO@SPAMqwest.netPLEASE> wrote in message
news:ur%23JZjGAEHA.3712@tk2msftngp13.phx.gbl...
> Hi,
>
> "Jacques Koorts" <jkoorts@ccalimited.com> wrote in message
> news:1048t07i1967oc6@corp.supernews.com...
> > I've tried to use Option Explicit but don't know where to put this line
of
> > code. I've check through the docs on COM and could not find any
reference
> > that one can use option explicit in COM.
> >
> > any ideas?
>
> From your prior posts, I assume that, by "COM" you mean WSC. If not, then
> disregard this response. If so, the answer is yes. You can put it at the
> start of the global code for each component. If this is what you mean,
then
> for future reference, refer to WSC files or, more generally, to classes or
> XML encoding. COM can be any type of code that results in a standalone
> accessible component.
>
> Joe Earnest
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.564 / Virus Database: 356 - Release Date: 01-19-04
>
>



Re: Can one use Option Explicit in COM? by Joe

Joe
Tue Mar 02 11:43:41 CST 2004

Hi,

"Jacques Koorts" <jkoorts@ccalimited.com> wrote in message
news:1049gh243bgp101@corp.supernews.com...
> Hi,
>
> Yes sorry I forgot to mention that it was COM for WSC.
>
> I tried for example:
>
> function GetIP(strComputerName)
>
> Option Explicit
>
> GetIP = strComputerName
>
> end function
>
> but got the error "expected statement" on trying to register the COM. the
> error occurs on the line "Option Explicit".
>
> I'm using primalscript.
>
> How now?
>
> cheers
> jk

Top of the *global* code for the component:



<component id="...">
<registration ... />
<public>
<method name="..." />
...

<property name="..." get="..." />
...
</public>

<object id="..." progid="..." />
...

<script language="VBScript">
<![CDATA[

option explicit

dim ...'global variables
... 'global settings, etc.

function GetIP(strComputerName)
GetIP = strComputerName
end function

...

]]>
</script>
</component>


Joe Earnest



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.564 / Virus Database: 356 - Release Date: 01-19-04



Re: Can one use Option Explicit in COM? by Jacques

Jacques
Tue Mar 02 13:58:41 CST 2004

Ah thanks man, did not know one can do that, just a learned a bit more.

thanks again
jk

"Joe Earnest" <joeearnestNO@SPAMqwest.netPLEASE> wrote in message
news:OvqZfyHAEHA.2600@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> "Jacques Koorts" <jkoorts@ccalimited.com> wrote in message
> news:1049gh243bgp101@corp.supernews.com...
> > Hi,
> >
> > Yes sorry I forgot to mention that it was COM for WSC.
> >
> > I tried for example:
> >
> > function GetIP(strComputerName)
> >
> > Option Explicit
> >
> > GetIP = strComputerName
> >
> > end function
> >
> > but got the error "expected statement" on trying to register the COM.
the
> > error occurs on the line "Option Explicit".
> >
> > I'm using primalscript.
> >
> > How now?
> >
> > cheers
> > jk
>
> Top of the *global* code for the component:
>
>
>
> <component id="...">
> <registration ... />
> <public>
> <method name="..." />
> ...
>
> <property name="..." get="..." />
> ...
> </public>
>
> <object id="..." progid="..." />
> ...
>
> <script language="VBScript">
> <![CDATA[
>
> option explicit
>
> dim ...'global variables
> ... 'global settings, etc.
>
> function GetIP(strComputerName)
> GetIP = strComputerName
> end function
>
> ...
>
> ]]>
> </script>
> </component>
>
>
> Joe Earnest
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.564 / Virus Database: 356 - Release Date: 01-19-04
>
>