Microsoft Office 2013 Upgrade gives error object doesn't support this property or method on Selection.Goto RRS feed

  • Question

  • The following code works fine in Microsoft Word 2010. When I upgraded to Word 2013 it is failing on

    Selection.GoTo What:=wdGoToBookmark, Name:="ViolationDesc" + Trim(Str(CodeCnt))

    When I step through the code I get the following messages when I get to this..

    • This method or property is not available because this command is not available for reading
    • Object doesn't support this property or method

    I can use Intellisense to pull the Selection.Goto object

    Sub ProcessPSForNC(NC As String, _
                       PSList() As String, _
                       VioList() As String, _
                       OraDatabase As Object)
    Dim CodeCnt As Integer
    Dim CodeCntStr As String
    Dim PS As String
    Dim ECodeStr As String
    Dim ECode As String
    Dim NCWindow As String
    Dim Remedial As String
    Dim VioText As String
    Dim PSID As String
      CodeCnt = 1
      Do While CodeCnt <= 2
        CodeCntStr = Trim(Str(CodeCnt))
        PS = Trim(ActiveDocument.FormFields("Code" + CodeCntStr).Result)
        If PS <> "" Then
          If ActiveDocument.Bookmarks.Exists("NCCode" + CodeCntStr) Then
            PSID = "NC" + Trim(ActiveDocument.FormFields("NCCode" + CodeCntStr).Result)
            PSID = "0"
          End If
          NCWindow = ActiveDocument.Name
          ECodeStr = ActiveDocument.FormFields("Standard" + PS).Result
          If InStr(1, ECodeStr, "NC") Then
            ECode = "NC"
            If InStr(1, ECodeStr, "NI") Then
              ECode = "NI"
              If InStr(1, ECodeStr, "PN") Then
                ECode = "PN"
              End If
            End If
          End If
          Selection.GoTo What:=wdGoToBookmark, Name:="ViolationDesc" + Trim(Str(CodeCnt))
          VioText = Selection.Text
          Selection.GoTo What:=wdGoToBookmark, Name:="RemedialDesc" + Trim(Str(CodeCnt))
          Remedial = Selection.Text
          Call SavePS(PSList, NC, "", PS, ECode, "", Remedial, VioText, _
                      ActiveDocument.FormFields("CodeDesc" + Trim(Str(CodeCnt))).Result, OraDatabase, PSID)
          If ActiveDocument.FormFields("ViolationCorr" + CodeCntStr).CheckBox.Value Then
            Call CreateVioMem(VioList, PS, "DDV", _
                              ActiveDocument.FormFields("RMDate" + CodeCntStr).Result, _
                              NC, "", OraDatabase, PSID, False)
          End If
          If ActiveDocument.FormFields("ViolationNonCorr" + CodeCntStr).CheckBox.Value Then
            Call CreateVioMem(VioList, PS, "NCV", _
                              ActiveDocument.FormFields("InspectionDate").Result, _
                              NC, "", OraDatabase, PSID, False)
          End If
        End If
        CodeCnt = CodeCnt + 1
    End Sub

    jim neal

    Friday, March 3, 2017 5:30 PM

All replies

  • Hi JamesLNeal,

    I try to test that line of code on my side.

    it runs correctly.

    so please try to check that bookmark "ViolationDesc" + Trim(Str(CodeCnt)) is available in the document.

    you can also try to test this single line in separate sub.

    I found that you are using oracle database object.

    make sure that you had added the reference for that in References. this can be the cause for the issue if references are not added.

    I don't have oracle object , so I am not able to test your whole code.

    you can try to implement this suggestion and let me know about the results.

    I will try to provide you further suggestions to solve the issue.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, March 6, 2017 3:18 AM