-
Solved: from excel to word (fill bookmarks)
Hello
I have an excel file, that will open a word document with some bookmarks and then, try to fill those bookmarks, without delete them.The code is skipping those instructions:
Set r = doc.Bookmarks(strBM).Range
doc.Bookmarks.Add Name:=strBM, Range:=strText
the code to fill the bookmarks:
[vba]
Sub FillBM(strBM As String, strText As String)
Dim doc As Document
Dim r As Range
On Error GoTo Err_Handler
Set doc = Documents.Open(ThisWorkbook.Path & "\tabel")
With doc
r.Text = strText
Set r = doc.Bookmarks(strBM).Range
doc.Bookmarks.Add Name:=strBM, Range:=strText
End With
Err_Handler:
Exit Sub
End Sub
[/vba]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules