Back

Topic

[KB161]Restriction on Symbols that Include VBA Code

Tags: Scripting, VBA

14 years ago
By RM
Options
Print
Applies to:

PcVue version 7.20a onwards.


Summary:

This article advises on a limitation on symbols that include VBA code.


Details:

If you create an instance of a symbol containing a timer, then create another instance of it, only the latter (duplicate) instance is active.

This is due to a deliberate restriction on symbols in VBA projects. The number of symbol projects created is not the same as the number of instances because:

  • Each one uses system resources for loading and operation (through a memory restriction in VBA).
  • With identical, active symbol projects, it would not be possible to change all instances of a symbol by changing one symbol project.

So there is one VBA project for all instances of same symbol. The VBA project is dynamically connected to its instances when an event is received at an interface (MouseClick, MouseEnter etc.).

In the case of the timer, no events come from the interface (unless one passes the mouse over another timer instance) so the latest current context is used.

Advice

The VBA code associated with a symbol must be run from a mimic by these events:

  • MouseEnter.
  • MouseLeave.
  • MouseClick.

Note

The code should not be run from an ActiveX in VBA since you would not then know to which instance of the symbol the VBA project was connected.


Created on: 05 Nov 2010 Last update: 13 May 2024