PRJ41: ActiveCell Collection Causes MS Project to Hang (137551)



The information in this article applies to:

  • Microsoft Project for Windows 95 4.1
  • Microsoft Project for Windows 95 4.1a

This article was previously published under Q137551

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.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbcode kberrmsg kbprb kbprogramming KB137551