Z
Zack Halbrecht
Hi,
I'm writing a COM-AddIn for Microsoft Project 2003 that will copy
various Filters to the user's Global.MPT file using OrganizerMoveItem.
This code works if Use it in a VBA Macro, but I cannot for the life of
me get it to work in this COM-AddIn in C#.
I know that the AddIn itself is registering and connecting properly and
I am getting to this point OK:
public void OnStartupComplete(ref System.Array custom)
{
object oMissing = System.Reflection.Missing.Value;
try
{
applicationObject.OrganizerMoveItem(MSProject.PjOrganizer.pjFilters,
"C:\\Filters.mpp" , "Global.MPT", oMissing, oMissing);
System.Windows.Forms.MessageBox.Show("Good To Go");
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
}
}
I get a NullReference Exception on the OrganizerMoveItem line. I think
that the problem is with the second parameter FileName. I have tried
"C:\\Filters.mpp", applicationObject.ActiveProject.Name, "Filters.mpp"
(with Filters.mpp being passed to WINPROJ.exe On the start of debugging
- all with the same result.
If anyone could help me nip this thing I would be very very grateful.
Thanks in advance!
I'm writing a COM-AddIn for Microsoft Project 2003 that will copy
various Filters to the user's Global.MPT file using OrganizerMoveItem.
This code works if Use it in a VBA Macro, but I cannot for the life of
me get it to work in this COM-AddIn in C#.
I know that the AddIn itself is registering and connecting properly and
I am getting to this point OK:
public void OnStartupComplete(ref System.Array custom)
{
object oMissing = System.Reflection.Missing.Value;
try
{
applicationObject.OrganizerMoveItem(MSProject.PjOrganizer.pjFilters,
"C:\\Filters.mpp" , "Global.MPT", oMissing, oMissing);
System.Windows.Forms.MessageBox.Show("Good To Go");
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
}
}
I get a NullReference Exception on the OrganizerMoveItem line. I think
that the problem is with the second parameter FileName. I have tried
"C:\\Filters.mpp", applicationObject.ActiveProject.Name, "Filters.mpp"
(with Filters.mpp being passed to WINPROJ.exe On the start of debugging
- all with the same result.
If anyone could help me nip this thing I would be very very grateful.
Thanks in advance!