Quantitative Analysis
Parallel Processing
Numerical Analysis
C++ Multithreading
Python for Excel
Python Utilities

I. Motivation and design (PFE).
II. Installation of the Python for Excel.
III. Tutorial introduction into the Python for Excel.
IV. PFE Programmer's reference.
1. Direct access to Excel API.
A. Application object (PFE).
a. ActiveCell property (vba.Application).
b. ActiveSheet property (vba.Application).
c. ActiveWindow property (vba.Application).
d. ActiveWorkbook property (vba.Application).
e. Calculate method (vba.Application).
f. CalculateBeforeSave property (vba.Application).
g. Calculation property (vba.Application).
h. Dispatch property (vba.Application).
i. EnableEvents property (vba.Application).
j. Evaluate method (vba.Application).
k. ExecuteExcel4Macro method (vba.Application).
l. Intersect method (vba.Application).
m. MemoryUsed property (vba.Application).
n. Name property (vba.Application).
o. Path property (vba.Application).
p. PathSeparator property (vba.Application).
q. Quit method (vba.Application).
r. Run method (vba.Application).
s. ScreenUpdating property (vba.Application).
t. Selection property (vba.Application).
u. StatusBar property (vba.Application).
v. Union method (vba.Application).
w. Windows property (vba.Application).
x. Workbooks property (vba.Application).
B. Workbooks object (PFE).
C. Workbook object (PFE).
D. Worksheets object (PFE).
E. Worksheet object (PFE).
F. Range object (PFE).
G. Borders object (PFE).
H. Border object (PFE).
I. Interior object (PFE).
J. Names object (PFE).
K. Name object (PFE).
L. Font object (PFE).
2. Lower level access to Excel API.
3. Event trapping (PFE).
4. Configuration files (PFE).
Index. Contents.

EnableEvents property (vba.Application).

f EnableEvents property of the Application object is set to True then Excel fires events. If EnableEvents is False then Excel does not fire events. There is however additional complication. Consider the session on the picture.


We have set the Application.EnableEvents to False and then attempted to execute another command. The ControlShell is not getting any response from the addin inside the Excel application. This is not a bug. This is more an insight on how ControlShell works. ControlShell is a standalone application that accepts commands from the user and forces the Excel to generate a special event via out-of-process COM protocol. The PFE addin inside the Excel catches such special event and executes commands from the ControlShell in-process until there is nothing left to do. Then the addin signals the completion to the ControlShell and releases control of the Excel. However, in the present situation Excel does not fire events. Hence, the PFE addin never gets control and never signals to the ControlShell that the last command has been completed. The ControlShell thinks that the PFE addin is still processing.

The above does not mean, however, that one cannot use the EnableEvents property. This property may still be manipulated inside of a script placed in a file (execfile or otherwise). Just make sure that EnableEvents is True before the script exits.

If you find yourself in the above situation then you need to set EnableEvents to True from "Immediate" window of VBA for Excel screen. Then kill the addin shell in the ControlShell window by pressing <Ctrl>+<Delete> at the waiting prompt. Consequently, you may resurrect it by pressing one of the combinations <Alt>+<Shift>+<P>, <Alt>+<Shift>+<Q>, <Alt>+<Shift>+<Z> from Excel.

Index. Contents.

Copyright 2007