PRJ41: ActiveCell Collection Causes MS Project to Hang

ID: Q137551

The information in this article applies to:

SYMPTOMS

When you use the Visual Basic for applications ActiveCell.Task or ActiveCell.Resource collection, you may receive the following error message:

   WINPROJ caused an invalid page fault in module VBA32.DLL

CAUSE

This problem occurs when the ActiveCell collection is set equal to a variable, the ActiveCell changes, and the macro that contains this code is run more than one time. For example, if you run the following macro twice and select a new task on the second run, Microsoft Project will hang:

   Sub Test()
        Set t = ActiveCell.Task
        MsgBox t.Name
   End Sub

WORKAROUND

To work around this problem, use either of the following methods.

Microsoft provides examples of Visual Basic for applications procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.

Method 1:   Use the ActiveCell collection directly without setting a
            variable equal to it, as in the following example:

              Sub Test()
                 MsgBox ActiveCell.Task.Name
              End Sub

Method 2:   Use the ActiveSelection collection, as in the following
            example:

              Sub Test()
                 Set t = ActiveSelection.Tasks
                 MsgBox t(1).Name
              End Sub

STATUS

Microsoft has confirmed this to be a problem in the products listed at the beginning of this article. We are researching this problem and will post more information here in the Microsoft Knowledge Base as it becomes available.

Additional query words: 4.10 4.10a crash bomb lock up gpf gp fault

Keywords          : kbcode kbprg
Version           : 4.10 4.10a
Platform          : WINDOWS
Issue type        : kbprb

Last Reviewed: November 25, 1997