How to test for a selected blank line that is NOT an activity RRS feed

  • Question

  • I have written and am using a macro to change the case (Upper, Lower, Proper, Sentence) of an Activity Name. It works successfully on all tasks, all summary tasks, and all selected tasks.


    But the selected routine fails (produces a VBA error) when one of the selected lines is completely blank (it doesn’t even have a task number assigned yet). That means, the current selection is on a line that is below the current task list.


    In this case, it seems that using the collection of all project tasks, ActiveProject.Tasks, is ineffective, since this line is not an activity. Likewise, the standard test for ‘Nothing’ (If Not tskTask Is Nothing Then) will not work either since the selected lines are not yet activities.


    What is the VBA code needed to test for this type of object?


    Thanks a lot.


    Larry fromVegas

    Tuesday, August 23, 2011 7:45 PM


All replies

  • Hi,

    If activeselection=0 then


    Tuesday, August 23, 2011 8:03 PM
  • That did it! Thanks so much. You've helped me several times before and I certianly appreciate your expertise and your time spent.
    Tuesday, August 23, 2011 8:34 PM