Barvna shema: Svetla
Trenutno dejavna stran: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » WKL Forms Object Library how-to guides » How to: Exchange plans with Microsoft Project

How to: Exchange plans with Microsoft Project

Hand a plan to someone who works in Microsoft Project and bring their changes back, or take over a plan that was started in Project, without creating duplicates or losing records.

Requires WKL Forms Object Library 1.23 or later.

Solution overview

ExportToProject writes Microsoft Project XML (Project opens it with File › Open, file type XML). ImportFromProject reads that kind of file and matches its tasks to the records: a task that finds its record updates it, and the rest are added. Dependencies and resource assignments are matched pair by pair (predecessor and successor, task and resource). ProjectUidField stores the unique ID (UID) that Project assigns to each task, so the match holds in both directions. With ShowDialog (or Import from MS Project … on the shortcut menu), users review and correct the proposed changes before anything is written.

Implementation

A round trip: the plan goes to Project and comes back.

With Me!Gantt1.Object
    .ExportToProject "Plan.xml"
    ' ... edited and saved as XML in Project ...
    Debug.Print .ImportFromProject("Plan.xml") & " tasks changed"
End With

The first import of a plan created in Project, whose UIDs don't match anything in the table yet:

With Me!Gantt1.Object
    .ProjectUidField = "ProjectUID"                       ' a Long field of tblTasks
    .ImportFromProject "Relocation.xml", wgiName, False, True   ' by name, check in the dialog
    ' From now on: by the stored UID, also after renaming in Project.
    .ImportFromProject "Relocation.xml"
End With

Delete the records that are no longer in the file, along with their dependencies and assignments:

Me!Gantt1.Object.ImportFromProject "Plan.xml", DeleteMissing:=True

Remarks

  • Matching (MatchBy): wgiAuto uses ProjectUidField if it's set and the key otherwise; wgiKey suits files that ExportToProject wrote from a table with a Long or AutoNumber key; and wgiName, meant for a first import, compares the name and the names of all summary tasks above it.
  • New records get an AutoNumber key, or the task's UID if the key is numeric and that value is free, so a second import finds them even without ProjectUidField. With a composite key, new tasks can't be added; match them to existing records in the dialog box instead.
  • What's written: name, start, finish (or duration), progress, milestone, constraint, deadline, baseline, and position in the outline, wherever they differ. Summary tasks keep their calculated dates. Nonworking days from the calendar go into HolidaySource; working days and hours are form properties and aren't changed (the dialog box tells you when they differ).
  • Round trips stay stable: for every task without a constraint, the export writes a „Start No Earlier Than“ constraint on the task's own start, so Project keeps the dates; the import reads it back as „As Soon As Possible“. Importing an unchanged file doesn't write anything.
  • Not exchanged: manual scheduling (the Project 2007 XML format has no field for it, and Project schedules the tasks itself, so a task that violates a dependency in wgsManual moves in Project), the gaps in split tasks, and the chart's appearance.
  • Everything is written in a single transaction; if an error occurs, nothing is written. Called from code, the import doesn't raise events; from the dialog box, every record raises BeforeUpdate/AfterUpdate.
en/wiki/msaccess/comctl/how-to/exchange-plans-with-ms-project.txt · Zadnja sprememba: uporabnika Wolfgang van der Stille