MS Project VBA bug

I receive a Run Time error '1101', Application-defined or object-defined error when the following is executed for a network diagram view that has a filter assigned to it.

 

            stgList = stgList & "Filter:  " & vwSingle.Filter & vbCrLf

What is vwsingle?

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I receive a Run Time error '1101', Application-defined or object-defined error when the following is executed for a network diagram view that has a filter assigned to it.

 

            stgList = stgList & "Filter:  " & vwSingle.Filter & vbCrLf


Yes it was.

Dim vwSingle As ViewSingle

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi,

Two more questions:

- Did you actually set a value for the variable vwsingle, for instance like this:

set vwsingle = GlobalViewsSingle(ActiveProject.CurrentView) ?

- If yes, you should use filter.name instead of filter

Greetings,

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I have the following code:

Dim vwSingle As ViewSingle
Dim vwSingles As ViewsSingle
Dim prj As Project
Set prj = ActiveProject
Set vwSingles = prj.ViewsSingle
For Each vwSingle In vwSingles


I just incorporated your suggestion and I have good news and some bad news.  The good news I didn't get the error message.  The bad news I still get a '1101' error but this time it states "The argument value is not valid".

What I find interesting is that the error only seems to occurs for a Network Diagram view, but none of the other views that allow filters.

 

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Jan I still need to confirm it for other view types, but the network diagram view's data that causes the error has a filter that is defined in Global..mpt.  I also looked at the help for the Filter Object and it states that Name is the default Property returned for the object.  Any other thoughts are appreicated.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

space man,
Can you be a bit more specific. It seems to work fine for me.

I applied a simple filter to a test file consisting of a summary line and four tasks. The filter looks for Flag1. One task has the flag set so the Gantt and Network Diagram both display just that task. I ran the following macro based on your code.

Sub test()
Dim vwSingle As ViewSingle
Dim vwSingles As ViewsSingle
Dim prj As Project
Set prj = ActiveProject
Set vwSingles = prj.ViewsSingle
For Each vwSingle In vwSingles
    Debug.Print vwSingle.Filter
Next vwSingle
End Sub

John

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.


John/Jan,

 

Thank you for your thoughts on the possible cause of the problem. 

As I stated in a previous reply to Jan, the filter is located in the Global.mpt which I just confirmed as the cause of the error.  I just added the same Filter to a Gannt Chart that is used by the Network Diagram and obtained the same error  result.

 

Apparently I've fallen victim to a case of  "NOT WYSIWYG".

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Space Man,
I'm a little confused. Is your problem solved or are you saying you still have the error ("...obtained the same error result")? If your question has been answered, then please mark it as so. If your problem still exists please elaborate so we can help you further.

John

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

John,

I understand the confusion I created with my last reply. The problem isn't totally resolved and futher investigation on my part leads me to beleive there is a VBA bug, as stated below.

 

 Here's what I've observed which hopfully better describes the issue viewed from the Organizer perspective of Global.mpt, and a project called X. 

  • The Global.mpt Filters tab show a Filter named Y in it's list, but  project X does not
  • A view, Z, in project X uses the filter named Y 

if I use VBA to request the filter name for the view Z in project X I get the error, however the view Z works properly and applies the filter.

Since the view executes properly I would expect VBA to return a valid filter name, but it doesn't.

 

I'm in the process of devloping and testing some code that if successful will work around the issue at which point I'll post that a a less than elegant implementation.  

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated September 30, 2021 Views 936 Applies to: