PRJ: Dialog Box Interrupts Macro Using OrganizerMoveItem Method (113768)



The information in this article applies to:

  • Microsoft Project 2000
  • Microsoft Project 98 for Windows
  • Microsoft Project for Windows 95 4.1
  • Microsoft Project for Windows 95 4.1a
  • Microsoft Project for Windows 4.0
  • Microsoft Project for the Macintosh 4.0

This article was previously published under Q113768

SYMPTOMS

In Microsoft Project, when you use the OrganizerMoveItem method in a macro to copy an item in the Organizer dialog box to a project, a dialog box appears asking if you want to replace the existing item if an item with the same name exists in the project file you are copying to.

CAUSE

If an item with the same name exists in the project you are copying the item to, you are prompted to either replace the existing item, cancel the copy, or rename the item you are copying. The OrganizerMoveItem method does not have an argument that you can use to indicate that you want to replace an existing item with the same name.

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
To avoid receiving this confirmation dialog box when you copy items from one project to another, use the Alerts method with the Show argument value equal to False in your macro before the OrganizerMoveItem command. When you use the Alerts False command in a macro, no dialog boxes appear while the macro is running, and the default button in any dialog box that would appear is chosen.

For example, the following macro copies the Gantt Chart in Project1 to GLOBAL.MPT without displaying a dialog box asking if you want to replace the Gantt Chart in GLOBAL.MPT:
   Sub Move_View
      Alerts False
      OrganizerMoveItem Type:=0, FileName:="Project1", _
         ToFilename:="GLOBAL.MPT", Name:="Gantt Chart"
   End Sub
				
Because the default button in the dialog box that appears asking if you want to replace the Gantt Chart in GLOBAL.MPT is Yes, the macro replaces the Gantt Chart in GLOBAL.MPT with the Gantt Chart in Project1.

Note that when you use the OrganizerDeleteItem method in a macro to delete an item in the Organizer dialog box, a dialog box does not appear asking if you want to delete the item.

REFERENCES

For more information about the OrganizerMoveItem method, choose the Search button in the Visual Basic Reference and type:

OrganizerMoveItem Method


Modification Type:MajorLast Reviewed:6/23/2005
Keywords:kbmacro kbprb kbusage KB113768