Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Project Findnext problem

Status
Not open for further replies.

tzigone

MIS
Aug 11, 2003
42
TR
Hello,
I am writing a VBA code in Ms Project. I want to take start dates and deadlines of tasks and mail it to resources. However my FindNext does not work. I do not understand why really. Could you help me?
Burcu

Sub mail1()
Dim i As Integer
Dim m As PjMailField
Dim b As Boolean
Dim govde As String

SelectBeginning
b = Find("Start", "equals", Date)




Do
SelectRow
MsgBox ActiveSelection.Tasks(1).Resources.Count & ActiveSelection.Tasks(1).Name

'If Not ActiveSelection.Tasks(1).Resources.Count = 0 Then
'For i = 1 To ActiveSelection.Tasks(1).Resources.Count
'If ActiveSelection.Tasks(1).Deadline <> &quot;&quot; Then
'govde = &quot;Bu otomatik bir iletidir.&quot; & &quot;Görev Adi:&quot; & ActiveSelection.Tasks(1).Name & &quot;Teslim Tarihi:&quot; & ActiveSelection.Tasks(1).Deadline
'Else
'govde = &quot;Bu otomatik bir iletidir.&quot; & &quot;Görev Adi:&quot; & ActiveSelection.Tasks(1).Name
'End If

b = MailSend(&quot;burcu.kagnici@introsolutions.com&quot;, , &quot;deneme&quot;, govde, , False)
'ActiveSelection.Tasks(1).Resources(i).EMailAddress
'Next i
'End If
MsgBox ActiveSelection.Tasks(1).Name
Loop While FindNext


End Sub
 
In fact find method in edit menu does not work also. it finds the first matching date than it says reach end of the field.
POffff
 
Hi tzigone,

FindNext does not stop at the end; it wraps back to the beginning, so if you have any tasks starting today, you will loop forever.

You must remember something, like the Task ID, after the first Find, and check it after each FindNext to see if you have wrapped. Something like ..

[blue]
Code:
SelectBeginning
b = Find(&quot;Start&quot;, &quot;equals&quot;, Date)
[red]
Code:
saveID = ActiveSelection.Tasks(1).ID
[/red]
Code:
:
:

        MsgBox ActiveSelection.Tasks(1).Name
[red]
Code:
        b = FindNext
        If b Then
            If ActiveSelection.Tasks(1).ID = saveID Then
                b = False
            End If
        End If
[/red]
Code:
Loop While
[red]
Code:
b
[/red]
Code:
[/blue]

I'm sure you can tidy that up a bit, but you should get the idea.

Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top