carlrubber
New Member
- Joined
- Oct 15, 2016
- Messages
- 48
Hi all,
I am new in vba and now i would insert a target cell value in excel to a word document bookmark by following code,
the error is come from ws.Range(Target.Row, Target.Column).Value
anyone could help please.
Thank you
I am new in vba and now i would insert a target cell value in excel to a word document bookmark by following code,
the error is come from ws.Range(Target.Row, Target.Column).Value
VBA Code:
Sub InsertAfterBookmark()
Dim objWord As Object
Dim ws As Worksheet
Dim I As Long
Set ws = ThisWorkbook.ActiveSheet
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Open ("C:\Desktop\New folder\_20220808.doc")
With objWord.ActiveDocument
.Bookmarks("MR").Range.InsertAfter ws.Range(Target.Row, Target.Column).Value
End With
Set objWord = Nothing
End Sub
anyone could help please.
Thank you