A family of Microsoft relational database management systems designed for ease of use.
WoodyPMP,
You can use ActiveProject.CurrentView and ActveProject.CurrentFilter to determine what is active.
John
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Is there a way to determine if a task meets the currently selected filter? I need a loop to process only the filtered tasks.
Sub test()
Dim T As Task
For Each T In ActiveProject.Tasks
' do something
Next T
End Sub
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
WoodyPMP,
You can use ActiveProject.CurrentView and ActveProject.CurrentFilter to determine what is active.
John
Unfortunately, I don't have the luxury of knowing the name of the filter in advance. It would be nice if the Task class had a Visible property. I need to be able to loop through all tasks or only those that are visible.
Dim iResponse As Integer, ts As Tasks
' Determine if user wants to export all tasks or visible tasks only
iResponse = MsgBox("Export visible/filtered tasks only", vbYesNoCancel)
Select Case iResponse
Case vbYes
SelectAll
Set ts = ActiveSelection.Tasks
Case vbNo
Set ts = ActiveProject.Tasks
Case vbCancel
Exit Sub
End Select
WoodyPMP,
Well yeah, that's right. Since "SelectAll", or any select statement, is operating on the active view pane, you need to insure that the active pane is the one with the filtered task set. Nothing "unreliable" about it, that's the way it works.
One solution is to add a statement to your code to activate the appropriate filtered view, then use the SelectAll for the ActiveSelection.Tasks set.
John
I had tried that approach already. Unfortunately, I found it to be somewhat unreliable. It requires that you call SelectAll method. That method sometimes throws error depending on what part of the interface has the focus. For instance, if you have a split view and the focus is in the task form. When you call SelectAll, you get Run-time error 1100 (The method is not available in this situation)
Hi,
Yes there is:
Sub Filtered
Select all
for each Job in activeselection.tasks
...
next
end sub
Greetings,