No tasks remaining in the filtered selection.

R

Ronald Dodge

I have my code filtering the tasks for those that are incomplete. Here
lately, there has been few mini schedules that has had all of their projects
completed, but yet, not unlinked, so when the program filters for incomplete
tasks, not a single task is returned (as expected). The code will then
select the sheet, then try to copy the sheet, and it errors out cause
there's not a single task in the list. To get around the error, I have
tried the following code, but to no avail, it didn't do the trick as I still
get the error message.

MSProj.FilterApply Name:="All Incomplete"
MSProj.SelectSheet
If MSProj.ActiveSelection.Tasks.Count > 0 Then
MSProj.EditCopy
FilterAllTasks = 1
Else
FilterAllTasks = 2
End If

The above code is inside of a function and the MSProj is the application
object since it's actually ran from an Excel VBA.

NOTE: I have a basic understanding of MS Project in regards to how it works
on the user side and I have a pretty good understanding of how VBA works, I
just may not know the specific objects/properties from the code side of MS
Project that would work best.
 
J

Jan De Messemaeker

Hello Ronald,

Personally I use on error to dectect this empty selection, but a few weeks
ago I learned from a tedious searcher that
activecell.task is nothing
does work and gives true when the selection is empty.

HTH
--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
Project Management Consultancy
Prom+ade BVBA
32-495-300 620
 
R

Ronald Dodge

Thank you for the info as that did the trick. I normally use On Error as
well, but this particular error didn't return an error number for me to trap
for it. Though in most cases, it wouldn't matter as much, but in this case,
I needed to be able to trap the error with this particular error being
handled differently.

BTW, do you know why MS Project is so picky as to which route the resource
pool file is opened from (the file that has the links to the various project
files)? If you open the file with the same route as it was saved in, it
seems to work fine, but any other route to that file, it not only opens in
read-write mode, but opens a second copy of it in read-only mode, which then
takes it a lot longer to open and a lot more restrictive as to what you can
do. If you don't know, it's no real biggy as we already have a procedure in
place to address this particular known issue. I found out about this issue
real early when I attempted to use UNC to get to the files while everyone
else was and still is using mapped drive method to it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top