none
how do I access the ms project 2010 classes from visual Studio? RRS feed

  • Question

  • I have installed Visual Studio 2012 and am trying to convert VB Macros to VB is studio.

    In the VB Macro, I access the resource count like this:

        l_Number_Of_Resources = ActiveProject.Resources.Count

    Is studio, I was trying to do it like this, but it throws an error:

        l_Number_Of_Resources = Application.Resources.Count

    There are other set of code such as this that will also probably cause problems:

        For Each asg In Application.Resources(c_res).assignments

    How do I access the data structures of the current open Project in VB in visual Studio?

    Thanks.

    Each asg In Application.Resources(c_res).Assignments

    Friday, April 5, 2013 2:42 PM

Answers

  • Sylvan,

    When I looked at the SDK, the examples are C# and not visual basic. I have built the project in VSTO for Project. When I use F5 to debug my code, it launches Project. But what I an struggling with is how to access specific values assocaited with the file I have opened, such as the Path, File Name, Resources structure etc.

    In the VB native to MSProject, it is accessed by ActiveProject.Path, or ActiveProject.Resources etc.

    I have subsequently discovered that if I use Application.ActiveProject.Path etc. it works.

    Thanks

    • Marked as answer by FlyBoy54 Friday, April 5, 2013 5:14 PM
    Friday, April 5, 2013 5:12 PM

All replies

  • Hi,

    The answer dépends on what you are exactly trying to do.

    If you write VBA Macro, your code will be executed into Project Pro: this kind of development does not require Visual Studio, but the VBA Editor which is Embedded in Project Pro (like the other Office products).

    Visual Studio is required for development for Project Server. In this case, the code will run on server side:

    - Customizing ribbon on PWA

    - Performing action when you clic on a new button in the ribbon

    - Handling server side events (for exemple when a user Saves his project, you want to make additionnal operations)

    If you have to make this kind of development, you should download the Project Server SDK (depending on your version, 2010 or 2013).

    Here some URLs for downloading the SDK:

    Project 2013: http://www.microsoft.com/en-us/download/details.aspx?id=30435

    Project 2010: http://www.microsoft.com/en-us/download/details.aspx?id=15511

    On this SDK you will find a lot of information, sample code, tutos, etc...

    If more help needed, this forum is yours ;-)

    Sylvain 

    Friday, April 5, 2013 3:37 PM
  • I have downloaded the SDK and will ook at it. At the 50,000 foot leve I an trying toi write a generic Add-in for MSProject and was led to believe that I had to use Visual Sutdio to do that. Is that correct?

    Thanks.

    Friday, April 5, 2013 3:59 PM
  • You have to take a look at VSTO. This kind of .net project targets office products, like project,Outlook, etc... The project generates a .net assembly, plugged as an Addin to Project. When you create a new vsto project for office, a project squeleton is created, and all main assemblies are références. You will find different entry points, and the possibilty to handle events. The sdk will give you all necessary explaination to start. Hope it helps you !

    Sylvain

    Friday, April 5, 2013 4:37 PM
  • Sylvan,

    When I looked at the SDK, the examples are C# and not visual basic. I have built the project in VSTO for Project. When I use F5 to debug my code, it launches Project. But what I an struggling with is how to access specific values assocaited with the file I have opened, such as the Path, File Name, Resources structure etc.

    In the VB native to MSProject, it is accessed by ActiveProject.Path, or ActiveProject.Resources etc.

    I have subsequently discovered that if I use Application.ActiveProject.Path etc. it works.

    Thanks

    • Marked as answer by FlyBoy54 Friday, April 5, 2013 5:14 PM
    Friday, April 5, 2013 5:12 PM