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!

How To Integrate MS Project in VB.NET? 1

Status
Not open for further replies.

vinidel

IS-IT--Management
Jan 23, 2004
78
US
I am using following code to use Microsoft Project 2003 object model in VB.NET

Imports Microsoft.Office.Interop.MSProject

Also I have references set to Microsoft Project 11.0 Object Library

I have two questions:

1. When I use following code to instantiate an object, I do not get any compile errors.

Dim proj As Project
proj = New Project

But when I run my VB.NET code I do get following error at above code:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in ProjectTest.exe
Additional information: COM object with CLSID {1019A320-508A-11CF-A49D-00AA00574C74} is either not valid or not registered.


2. Second question: I want my VB.NET code to check the user system, on which its running to check Microsoft Project 2003 is running(means user is using Microsoft Project 2003).

Any suggestion, help or guidance will be appreciated.

Thanks

vinidel
 
#2. thread796-776090

I've written a function that will search for a process(es) by name with the option to kill it. Check the link above.

Scott
Programmer Analyst
<{{><
 
HI stnkyminky,

Thanks for your solution. But I also need to read some information from the running MS PRoject application.

I am calling VB.NET application from MS Project 2003 using shell command. But I also need to know what Project ID is calling the VB.NET program. So I need to read one of the property in MS Project.

Or else if there is another way of calling VB.NET application and I can pass the info to it. ?

Thanks
 
You could adapt your vb.net app to accept command line parameters. Then call the app using the shell command and pass the project id to the app.

ex. myapp.exe 1 <---- this represents the project id

Scott
Programmer Analyst
<{{><
 
and how can I adapt my vb.net app to accept command line parameters ?

Thanks
 

args is declared as a public variable and has scope for the entire form.
Code:
public args() as String

Place this code in the SubMain Event or just below the call to InitializeComponents in the New() sub of the Windows Form.
Code:
args = Microsoft.VisualBasic.Command.Split(" ")

Place this code in the Form_Load Event. This basically proves that you have read in the variables and can now do whatever you want with the data.
Code:
        Dim i As Integer
        For i = 0 To UBound(args)
            MsgBox("The value for parameter " & i + 1 & "  is " & args(i))
        Next


Calling the program from the command line like(myapp.exe This is a test) will display each word after myapp.exe in a message box.



Scott
Programmer Analyst
<{{><
 
hey stnkyminky,

Thanks a lot for the perfect solution. Its working exactly the way I wanted too. Credit goes to you.

This is the second time that your solution helped me.

Thanks again.

vinidel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top