"Option Explicit" not work!

code:dim sName as string

sName = session.username

complie is success,but run fail, because “session” is not define. I put “Option Explicit” in (Globals)-Options section, the complier should tell the error!

Subject: “Option Explicit” not work!

That is a pretty broad generalization to make. Where are you putting this code and is it possible you have session declared somewhere else as a global variable?

Subject: RE: “Option Explicit” not work!

NO! NEVER!when code is run, notes display a error message “Variant does not contain an object”

Subject: RE: “Option Explicit” not work!

try “Option Declare” instead

Subject: “Option Explicit” not work!

I used your piece of code in one of my agents and I cannot compile it! I am working with R6.5.

Do you have any other statements in Declaration?

Do you have defined any classes and inside there session defined?

Subject: RE: “Option Explicit” not work!

yes, “Option Explicit” work with agent, but still not work with form.

If you create an button in form, the button has a “(OPtions)” section, If you put “Option Explicit” in this section, complier will prompt you error, But if you put “Option Explicit” in form’s “(Options)” section, the complier will not prompt you any syntax error. BUT IN R5, complier will prompt error message.

Subject: RE: “Option Explicit” not work!

Well, on my form it is working correct. I cannot compile(save) a form which contains a button where I put Explicit in Options and use your code in Initialize.

Subject: RE: “Option Explicit” not work!

Notes is working as designed. A form contains distinct LotusScript “Objects”. All the code for one Object appears under the same twistie in the code navigation pane. The (Options) section in one Object applies only to the code in that Object. So, options defined in the (Globals) apply only to code within that same twisty. The options in the (Form) section apply only to code under that twisty, e.g. the form events. The options defined in your button code Options section are the only ones that apply to your button code.

In an agent, there’s only one object in the whole agent, so there is only one place to set options for the whole agent. In a form, there are potentially many different objects, including two – Globals and the Form section – that are always present.

Subject: never mind

Subject: “Option Explicit” not work!

In R6 you can finally set an option in the client to add the “Option Declare” statement to every declarations section of every module in databases created after you enable the setting. Then it will work everywhere.

http://www.lotus.com/ldd/doc/domino_notes/Rnext/help6_designer.nsf/855dc7fcfd5fec9a85256b870069c0ab/b94a4d31b67c727585256c54004ba307?OpenDocument