nouveaux21
11-01-2004, 08:12 AM
Hello! I am trying to open an MSProject 2003 file, spit some data into it, then save and close (all from VB.Net)... So far, the code I have is as follows (with the .mpp file residing as c:\Project1.mpp)... All I get is "access denied" (I checked the security settings to make sure everyone can edit)... Am I even opening the file correctly? Any help will be GREATLY appreciated! Thanks! (And now for the code): Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Dim ms_proj_application As New Microsoft.Office.Interop.MSProject.Application Dim ms_proj_task As Microsoft.office.interop.msproject.Task Dim prj As Microsoft.Office.Interop.MSProject.Projects upload(ms_proj_application, ms_proj_task, prj) MsgBox("Project Data Uploaded", MsgBoxStyle.Information, "Project Data Uploaded") End Sub Private Sub upload(ByVal ms_proj_application, ByVal ms_proj_task, ByVal prj) 'from discussion boards... 'The add statement returns an object to the new project, so: prj.BuiltinDocumentProperties("Subject") = "Project Subject" prj.BuiltinDocumentProperties("Title") = "Project title" ms_proj_task = prj.Tasks.Add.Name ms_proj_task.Name = "Task Name" prj.Resources.Add.Name = "jason thompson" ms_proj_application.Add.SaveAs("c:/Project1.mpp", Microsoft.Office.Interop.MSProject.PjFileFormat.pjMPP) End Sub End Class |