Problem accessing project document custom properties

T

thoff

I'm trying to access the build-in document properties in VB in Visual Studio
2008 with the following code:

Dim proj As Microsoft.Office.Interop.MSProject.Project
Dim f As New AddFunction
Dim properties As Microsoft.Office.Core.DocumentProperties
Dim prop As Microsoft.Office.Core.DocumentProperty

proj = Globals.ThisAddIn.Application.ActiveProject
f.ShowDialog()
properties = DirectCast(proj.BuiltinDocumentProperties, _
Microsoft.Office.Core.DocumentProperties)

prop = properties.Item("Source")
MsgBox(" Source = " & prop.Value)
proj = Nothing

When I run this I get the following error message.

A first chance exception of type 'System.ArgumentException' occurred in
ProjectAddIn2.DLL

Can anyone give me some advice? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top