none
Project 2010 VBA - Editing a Filter to Add a Field RRS feed

  • Question

  • I am writing a VBA module for Project 2010. In that module I am trying to edit an existing filter by adding another field name to check. Here's what I wrote:

    FilterEdit Name:="Company", TaskFilter:=True, Create:=False, OverwriteExisting:=False, Parenthesis:=True, _
                    FieldName:="% Complete", Test:="does not equal", Value:=100, ShowInMenu:=False, ShowSummaryTasks:=True

    The "Company" filter already checks a field I call Company.

    Currently I get a run-time error 1004 saying that I do not have a valid field name. I assumed that it doesn't like the '%' character, but it doesn't seem to like any field name no matter what I enter, like "Finish".  

    1) Is this the way to edit a filter to add another field to check?

    2) Why is it complaining about an invalid field name if that column exists?       

    Tuesday, October 21, 2014 11:30 PM

Answers

  • Hi Mr. Christopher Lee,

    An easy way to create this kind of code is to record a macro:

    • View > Macro's > Record Macro
    • Change the macro name to 'EditFilter' and click 'Ok'
    • Add the field to the filter
    • View > Macro's > Stop Recording
    • The code you need can now be copied from the Visual Basic Editor (Alt + F11) in the modules section (a sub EditFilter should be created)

    Hope this helps

    Wednesday, October 22, 2014 8:34 AM

All replies

  • Hi Mr. Christopher Lee,

    Thanks for posting in MSDN forum.

    Since the issue is relative to Project, I would like to move it to Project Customization and Programming forum.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Thanks for your understanding.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 22, 2014 7:09 AM
  • Hi Mr. Christopher Lee,

    An easy way to create this kind of code is to record a macro:

    • View > Macro's > Record Macro
    • Change the macro name to 'EditFilter' and click 'Ok'
    • Add the field to the filter
    • View > Macro's > Stop Recording
    • The code you need can now be copied from the Visual Basic Editor (Alt + F11) in the modules section (a sub EditFilter should be created)

    Hope this helps

    Wednesday, October 22, 2014 8:34 AM