Adding watermark in word using Access VbA

Hi Contractor

It displays an error message "Bookmark {Username} There is a mapping error with this document please contact your administrator."
Please help me in this.
Thanks
 
That error is now removed but now I am getting error 13 Type mismatch at "Proc InsertBookMarkText" in the following sub:
Code:
Public Sub InsertBookMarkText(strBookmark As String, varText As Variant)
On Error GoTo ErrorHandler
    Dim BookmarkRange As Range
 
    Set BookmarkRange = WordDoc.Bookmarks(strBookmark).Range
 
    BookmarkRange.Text = varText & ""
    WordDoc.Bookmarks.Add strBookmark, BookmarkRange
    'BookmarkRange.Select
 
Exit_ErrorHandler:
    Exit Sub
 
ErrorHandler:
    Select Case Err.Number
        Case 4605 'this method or property is not available because the object is empty
            Resume Next
        Case 5941, 6028 ' member does not exist/the range cannot be deleted
            MsgBox "Bookmark {" & strBookmark & "} There is a mapping error with this document.  Please contact your administrator.", vbOKOnly
            Resume Next
        Case 91     'object variable not set
            Resume Next
        Case 4218   'type mismatch
            Resume Next
        Case Else
            msgbox Err.Number & vbcrlf & Err.Description & vbcrlf & vbcrlf & "Proc: InsertBookMarkText()",vbInformation + vbOKOnly,"Error"
            Resume Exit_ErrorHandler
        End Select
            Resume Exit_ErrorHandler
End Sub
 

Users who are viewing this thread

Back
Top Bottom