Make sure Objects/Collections valid before using them

K

Ken

I am new to VB, and thought I could do something like this:

if ActiveSelection > 0 and isObject(ActiveSelection.Tasks) then
:
if ActiveSelection.Tasks.Count > 10 then
message("Can't work on more than 10 tasks at a time")
end if
:
end if

This doesn't work if you have Resources selected or if you have no tasks
selected. Can anybody give suggestions on how to resolve this?

Thanks.
 
J

Jan De Messemaeker

Hi,

activeselection=0 actually does tell me whether a task is selected or not.

As for the resource issue I would test if application.currentview is within
the
activeproject.taskviewlist

HTH
 

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