Article ID: 113768
Article Last Modified on 1/18/2007
APPLIES TO
- Microsoft Office Project Professional 2007
- Microsoft Office Project Standard 2007
- Microsoft Office Project Professional 2003
- Microsoft Office Project Standard 2003
- Microsoft Project 2002 Professional Edition
- Microsoft Project 2002 Standard Edition
- Microsoft Project 2000 Standard Edition
- Microsoft Project 98 Standard Edition
- Microsoft Project 4.1 Standard Edition
- Microsoft Project 4.1a
- Microsoft Project 4.0 Standard Edition
- Microsoft Project 4.0 for Macintosh
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:
Additional query words: PRJ2002 PRJ2003 PRJ 2007 prj2000
Keywords: kbmacro kbprb kbusage KB113768