Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to VBA/VSTO for MS Project (PLEASE HELP)

Status
Not open for further replies.

fansari

Programmer
Jan 18, 2011
1
0
0
US
I am brand new to writing Add-Ins. I have searched for things which seem to be simple but did not find any answers. Any help will be greatly appreciated. Here is my problem:

I am using Visual Studio Professional (VB) 2008 and MS Project 2007 (Not Server). I have created a form with all the fields in a project & a button on the MSP interface which brings up the form. Is there a way to highlight a particular task in the open project & when I open the UI I get the fields populated with the values in the highlighted task? Or how can I select a task in MSP and then grab it's values? I want to be able to make any changes to any of the fields and then save the changes back to the MSP task. In other words I am trying to build a simple UI on top of MSP.

Please help. Thank you in advance
 
I use VBA not VB. But in VBA you need to use ActiveSelection.Tasks(1). This has a variety of properties that should be what you want.

However - changing the values? As far as I'm aware most Task properties are Read-only and even if they are not, MSP is fragile enough when using the front-end, let alone if you change things in the background.

PDQBach is your man

Simon
 
@DrSimon

Thank you for the commendation. I deliberately delayed answering this query because I wanted to try a few things out. Your comment "MSP is fragile enough when using the front-end, let alone if you change things in the background" is spot on.

@Fansari
For things like task Name it's a simple thing to take the data from MSPrj, display it on the form, get updates and push those back to the MSPrj file. (DrSimon showed you how above.) But to get to the meat of the data means using TimeScaleData and there are enough issues with pulling the data out ... let alone pushing updated data back into MSPrj.
 
I'm glad PDQBach has joined in and, from your point of view, sorry that he's confirmed my thoughts. You need to realise that MS Project is really unlike the other Microsoft products (Word, Excel, Access and Outlook). When programming MSP you really need to know and understand the foreground program in a way that isn't required for the others. MSP clearly has enormous amount of cascading code underlying each action making things so complicated that Undo doesn't always work and even then no more than one step.

Things are a bit more flexible with the non-stand alone versions - but you say you're not using Server; otherwise consider the Import and Export wizards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top