ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open MS Project From Excel & read Task Properties List (https://www.excelbanter.com/excel-programming/401047-open-ms-project-excel-read-task-properties-list.html)

MVP Wannabe[_2_]

Open MS Project From Excel & read Task Properties List
 
I want to open a MS Project file and create a list of the Task table field
names. (e.g. ID, Name, Start, Finish, etc.) I want the complete list of field
names to populate to an Excel worksheet.

I am looking for code to do two things:

1: List the Task table field names from the task collection

2: Possibly open the MS project file without having a copy of MS project open.

Thanks in advance.

Colby Africa

Open MS Project From Excel & read Task Properties List
 
Oops, let's see. Something like this:

Dim projectApplication As New MSProject.Application

projectApplication.FileOpenEx "C:\data\temp\project.mpp"


Dim field As tableField

For Each field In
projectApplication.ActiveProject.TaskTables(projec tApplication.ActiveProject.CurrentTable).TableFiel ds
Debug.Print field.Title
Next

Is that what you are looking for?

Colby


MVP Wannabe[_2_]

Open MS Project From Excel & read Task Properties List
 
Seems close.



I get lots of blanks for titles and I am not sure if it is giving me the
same list as the enums that you get from taskItem.Name in your last post.

What I want is the same list that pops up when you type taskitem and the
period. I just want to loop through and I will send it off to an array.

Thanks again

"Colby Africa" wrote:

Oops, let's see. Something like this:

Dim projectApplication As New MSProject.Application

projectApplication.FileOpenEx "C:\data\temp\project.mpp"


Dim field As tableField

For Each field In
projectApplication.ActiveProject.TaskTables(projec tApplication.ActiveProject.CurrentTable).TableFiel ds
Debug.Print field.Title
Next

Is that what you are looking for?

Colby



Colby Africa

Open MS Project From Excel & read Task Properties List
 
I get the same result. Let me try it another way...

Colby


Colby Africa

Open MS Project From Excel & read Task Properties List
 
Got it:

Dim projectApplication As New MSProject.Application

projectApplication.FileOpenEx "C:\data\temp\project.mpp"

Dim field As TableField

For Each field In
projectApplication.ActiveProject.TaskTables(projec tApplication.ActiveProject.CurrentTable).TableFiel ds
Debug.Print FieldConstantToFieldName(field.field)
Next

I was missing the call out to FieldConstantToFieldName

Colby


MVP Wannabe[_2_]

Open MS Project From Excel & read Task Properties List
 
Excellent! Thanks!

"Colby Africa" wrote:

Got it:

Dim projectApplication As New MSProject.Application

projectApplication.FileOpenEx "C:\data\temp\project.mpp"

Dim field As TableField

For Each field In
projectApplication.ActiveProject.TaskTables(projec tApplication.ActiveProject.CurrentTable).TableFiel ds
Debug.Print FieldConstantToFieldName(field.field)
Next

I was missing the call out to FieldConstantToFieldName

Colby



Colby Africa

Open MS Project From Excel & read Task Properties List
 
No problem! Please rate this post if it was helpful and have a great
holiday!



All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com