1

I have some C# code which formats a MS Project file. This code works absolutely fine.

Problem: Now, I want to run the same C# code through a macro script.

Question: How can I execute the C# code through my MS Project macro. So, whenever the user opens an MS Project file, it runs the macro which in turn executes the C# code and formats the concerned file.

I am using Ms Project 2002.

Is this even possible? Please request for any additional information required.

reggie
  • 13,313
  • 13
  • 41
  • 57

1 Answers1

2

What you want to do use the Visual Studio Toolkit for Office (VSTO) to create an Office plug-in that will be called on application start or project load. You can find a good "getting started" article here.

The sample is in VB.NET but the same principles and object model is available in C#.

adamjford
  • 7,478
  • 6
  • 29
  • 41
Cos Callis
  • 5,051
  • 3
  • 30
  • 57
  • I just realized that I am running Ms Project Professional 2002. Is there an add-in for the same? – reggie May 20 '11 at 15:03
  • I think there is a way to create an add in for 2002, but I don't believe it is through the VSTO. You might consult Help for your version of Project or ask Google (How to make a plug in for MS Project 2002). – Cos Callis May 20 '11 at 15:05
  • On the other hand, is there any way I can call the C sharp code through a macro in Ms Project – reggie May 20 '11 at 15:08
  • 1
    In Project 2002 I do not believe the core had been converted to the .NET framework yet, so there is probably a compatibility issue. I was not an active user of Project in that time frame so I could easily be incorrect. Based on a quick search and finding: http://msdn.microsoft.com/en-us/library/Aa164318 and http://support.microsoft.com/ph/2680 I think you are not going to get the desired results directly. – Cos Callis May 20 '11 at 15:16