Bernard Marcelly wrote:
Hi Jan,

Private or Public variables live only during execution of a macro. Global variables survive between two executions.

In your dialog example this is same. The macro ShowDialog does not exit because Dlg.execute waits for the dialog to be closed. You can verify this by inserting a MsgBox("Hello") just after Dlg.execute.

Hi Bernard.

Ah - thanks. That explains it perfectly.

This behavior is not exactly clear from the Help description - here from the Help text about the "Dim Statement":

"Dim declares local variables within subroutines. Global variables are declared with the PUBLIC or the PRIVATE statement."

So we have global variables that do not hold data globally but only declare the variable globally. Strange notion... but of course useful when used in nested calls like I do in the dialog example code I listed.

Would be nice if the help described the lifecycle of variable content as well as the declaration scope.

Cheers
-- Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to