PDA

View Full Version : Copy Data from Excel to Project 2000



Pro53
11-26-2007, 09:01 AM
Hi

I am using Project 2000 and trying to copy some text from an Excel Spreadsheet range to the Title labels of the MS Project Text Field Columns (Text1-TextN) using a macro which edits the Table Entry and adds the text columns and changes the column definition label "Title" to the data supplied by the Excel Spreadsheet. E.g In Project Field Name "Text1" is added to the table entry view with the Title: "John Smith" (imported from Excel). I need to re-run the import when the data in the Excel file is changed.

I have the basic code working using TableEdit Name to add each column to
the end of the tasks table as follows:

TableEdit Name:="&Entry", TaskTable:=True, NewFieldName:="Text" & lnCounter, _
Title:=vaTeammembers(lnCounter, 1), Width:=10, Align:=2, ShowInMenu:=True, LockFirstColumn:=True, _
RowHeight:=1, ColumnPosition:=-1, AlignTitle:=1

(vaTeammembers is the data in Excel, lncounter is the row number of the data - 1 to N, Column position -1 adds the new column to the right of the last column).

However, each time the Macro runs it "adds" the columns to the table entry view again. That is columns Text1 to N (with new Title Labels) are duplicated.

Any ideas how to stop the TableEdit if any Text1-N column has a "Title" label the same as the Excel file data being imported or an alternative workaround to stop the columns being duplicated each time the import macro is run. I guess I need to access the "Title" Label value for each Text column and compare to the vaTeammembers(lnCounter, 1) value but not sure if it is possible or how in MSProject 2000.

TIA

lucas
11-27-2007, 09:28 PM
Hi Pro53,
I don't have Project so can't be much help but I moved your thread to the MS Project help forum and hopefully a regular Project user will drop by and help you with this.

nkamp
12-02-2007, 02:31 PM
Hi Pro53,

If I read question I understand that it is possible with VBA to exchange data between Excel and MSProject. I do not complete understand how?
From Excel I must open the MSProject file and then copy some relevant data to MSProject. If I open the mpp file from excel how can I achieve that I copy the data into the mpp file?
Can you help me with a example?

Thanks in advance?

Nico