none
Word macro enabled form erroring out or not populating with xml values from a sister application RRS feed

  • Question

  • Hello, I have been really having a hard time finding anything on the internet which addresses my particular problem/issue. Any help would be appreciated. What is happening is that I have a macro enabled word form, it basically works fine by the way on the newest version of word, but on older versions of word, it will error out when opened, or, it will not take xml values from a sister application and execute a series of checkboxes.

    The code on this is like this, and I am not a VBA person (excuse me, I am a Java developer and having a really hard time with this). I am not sure what to do. I have been working with someone on a different forum but they got frustrated and abandoned me.

    What we've developed so far is this:

    Private Sub Document_Open()
        Select Case ActiveDocument.FormFields("text64").Result
            Case "Yes"
                ActiveDocument.FormFields("Check1").CheckBox.Value = True
            Case "No"
                ActiveDocument.FormFields("Check2").CheckBox.Value = True
        End Select

    Select Case ActiveDocument.FormFields("text65").Result
        Case "Inpatient"
            ActiveDocument.FormFields("Check3").CheckBox.Value = True
        Case "ER/Outpatient"
            ActiveDocument.FormFields("Check4").CheckBox.Value = True
        Case "DOA"
            ActiveDocument.FormFields("Check5").CheckBox.Value = True
        Case "Nursing Home"
            ActiveDocument.FormFields("Check6").CheckBox.Value = True
        Case "Hospice"
            ActiveDocument.FormFields("Check7").CheckBox.Value = True
        Case "Residence"
            ActiveDocument.FormFields("Check8").CheckBox.Value = True
        Case "Other"
            ActiveDocument.FormFields("Check9").CheckBox.Value = True
        End Select

    Select Case ActiveDocument.FormFields("text66").Result
        Case "Married"
             ActiveDocument.FormFields("Check10").CheckBox.Value = True
        Case "Never Married"
             ActiveDocument.FormFields("Check11").CheckBox.Value = True
        Case "Widowed"
             ActiveDocument.FormFields("Check12").CheckBox.Value = True
        Case "Divorced"
             ActiveDocument.FormFields("Check13").CheckBox.Value = True
        Case "Unknown"
             ActiveDocument.FormFields("Check14").CheckBox.Value = True
    End Select

    Select Case ActiveDocument.FormFields("text67").Result
        Case "Yes"
             ActiveDocument.FormFields("Check15").CheckBox.Value = True
        Case "No"
             ActiveDocument.FormFields("Check16").CheckBox.Value = True
    End Select


    Select Case ActiveDocument.FormFields("text68").Result
        Case "No"
             ActiveDocument.FormFields("Check17").CheckBox.Value = True
        Case "Yes"
             ActiveDocument.FormFields("Check18").CheckBox.Value = True
    End Select

    Select Case ActiveDocument.FormFields("text69").Result
        Case "Resomation"
             ActiveDocument.FormFields("Check19").CheckBox.Value = True
        Case "Burial"
             ActiveDocument.FormFields("Check20").CheckBox.Value = True
        Case "Cremation"
             ActiveDocument.FormFields("Check21").CheckBox.Value = True
        Case "Removal from State"
             ActiveDocument.FormFields("Check22").CheckBox.Value = True
        Case "Donation"
             ActiveDocument.FormFields("Check23").CheckBox.Value = True
        Case "Other (Specify)"
             ActiveDocument.FormFields("Check24").CheckBox.Value = True
    End Select

    I am sure this is not right. What I am basically trying to do is populate a given checkbox associated with each entry (64-69) with an xml value that gets passed from a sister application as an object to the word document.

    If anybody has any examples of how to do this I would appreciate it very much, Thanks, Michele

    Wednesday, April 11, 2012 5:33 PM

All replies

  • BTW, the error I am getting sometimes is this one: run-time error 5941: the requested member of the collection does not exist.
    Wednesday, April 11, 2012 6:04 PM