Consulting

Results 1 to 1 of 1

Thread: Using the findex return value

  1. #1
    VBAX Newbie
    Joined
    Mar 2019
    Posts
    1
    Location

    Using the findex return value

    I am a novice in VBA and trying to tie some things from Project to Excel:

    I am trying to look up a task in project, and then return fields from the task and then populate particular cells in Excel.

    So I opened the project file successfully.
    'Open MS Project file
    PrjFullName = "C:\temp\wren.mpp" '<-- keep the MS-Project file name and path in a variable
    PrjApp.Application.FileOpenEx PrjFullName
    Set aProg = PrjApp.ActiveProject
    ' show all tasks
    OutlineShowAllTasks
    Set prjtasks = aProg.Tasks
    ' Set the type variable
    type = "document"
    ' Go into the Project File and find the type in the task name
    FindEx Field:="Text23", Test:="contains", Value:=type, Next:=True, MatchCase:=False, SearchAllFields:=False
    SelectTaskField Row:=0, Column:="Name"
    EditCopy
    So...
    The above code allows me to get one field, and then I can copy that item into Excel. However the above does not support error checking, ie if the findex doesn't find an entry then I need to know that. I was trying to use some sort of Boolean, but have been unsuccessful getting the return value from the FindEx. If the FindEx doesn't find anything the SelectTaskField defaults to the current row, which is not the desired behavior.

    Thanks in advance.
    Last edited by Aussiebear; 06-13-2025 at 01:43 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •