View Single Post
 
Old 07-22-2017, 08:45 AM
silentwolf silentwolf is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Dec 2016
Location: Austria
Posts: 16
silentwolf is on a distinguished road
Default Runtime Error 91

Hi guys,

I am not that good in word VBA and need some advice to this problem...

Below is the code but I do get a runtime error 91 in the line marked below.
Object Variable or with block not declared..

Could someone tell me what is causing this problem?


Code:
Property Get Textmarke(strName As String) As String
    DieseDateiBenutzen
    If p_docDO.Bookmarks.Exists(strName) Then
        Textmarke = p_docDO.Bookmarks(strName).Range.Text
    Else
        Textmarke = ""
    End If
End Property

Property Let Textmarke(strName As String, strText As String)
    Dim rngTM As Range

    If p_docDO.Bookmarks.Exists(strName) Then
    Set rngTM = p_docDO.Bookmarks(strName).Range

        rngTM.Text = strText
        rngTM.Bookmarks.Add strName
    Else
        MsgBox "Diese Textmarke fehlt: " & strName, vbCritical
    End If
End Property
Read on the help file but can not realy understand what I need to change.

Many thanks for your help..

Silentwolf
Reply With Quote