reate a fresh workbook and place the following code into the ThisWorkbook
module.
01\
Option
Explicit
02\
Private
Sub Workbook_Open()
03\
Dim
ws As Worksheet
04\
Set
ws = ThisWorkbook.Worksheets(1)
05\
Call
ws.Cells.Clear
06\
ws.Range("b1").Activate
07\
ws.Range("a1").Value
= "Everything is OK."
08\
End
Sub
Create a Module and place the following macro code.
01\
Public
Sub testMacro(i As Integer)
02\
ThisWorkbook.Worksheets(1).Range("a1").Value
= i
03\
End
Sub
Save, close and reopen the workbook. Go to VBA window and execute the
following line in the "Immediate" window.
The Excel application becomes non-responsive. This happens with a freshly
created workbook, when all add-ins are deactivated, including the PFE addin.
Only the VBA code is involved. The result is the same for Excel 2000 and Excel
2010.
There are three points that I want to propose after such experiment.
First, no matter how hard I try I cannot shield dear user from the fact that
Excel remains to be a buggy application. Not every bug is my fault.
Second, the ExecuteExcel4Macro works fine in most situations. Perhaps, using
the Activate() methods in the "open workbook" event handler is not a good
idea. The pfe-files are a principal tool of this product and these are
executed in the "open workbook" event handler. Please, remember that there are
slightly different rules of execution for the pfe-script itself and for the
event handlers that the pfe-script installs.
Third, Excel bugs are easy to replicate and localize. Consequently, there is
always a reliable way around any bug that you might encounter.
|