none
Extracting Field Value Following FindEx RRS feed

  • Question

  • I lost a project file with a macro I had created, and, having never before written a macro for Project, can't remember how I did something.  I have a VBA code snippet that looks like this:

    Sub Macro1()

        Dim bFindEx As Boolean
        Dim strText6 As String
        bFindEx = FindEx("Name", "contains", "10729", True, False, , , False)
        
    End Sub

    I do have code to handle an unsuccessful FindEx, but what I want to do if FindEx is successful is to assign the contents of the field Text6 to the variable strText6.  I use SetTaskField to set a new value, but I don't remember how to get the current value of the field.

    Thanks,

    Tim

    Tuesday, June 13, 2017 8:49 PM

All replies

  • Tim08,

    One way to do it is this

    Sub macroTim()
    Dim bFindex As Boolean
    Dim strText6 As String
    bfinex = FindEx("name", "contains", "10729, True, False, , , False)
    strText6 = ActiveSelection.Tasks(1).Text6
    End Sub

    Hope this helps.

    John

    Tuesday, June 13, 2017 11:19 PM
  • Thanks John - that worked.
    Wednesday, June 14, 2017 11:43 AM
  • TimS08,

    You're welcome and thanks for the feedback.

    John

    Wednesday, June 14, 2017 1:08 PM