Hi there,
Need some help with a formula. If by any chance the answer has been given on any other thread, please post a link.
My objective is to had content from an excel file into a word document. For doing that i use bookmarks and the following code:
1. For creating the word file
Set wdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set myDoc = wdApp.Documents.Add(Template:="xxxx.dotm")
wdApp.Visible = True
2. For coping content
Sheets("sheet name").Select
ActiveSheet.OLEObjects("clts_1").Object.SelStart = 0
ActiveSheet.OLEObjects("clts_1").Object.SelLength = ActiveSheet.OLEObjects("clts_1").Object.TextLength
ActiveSheet.OLEObjects("clts_1").Object.Copy
With myDoc.Bookmarks
.Item("clts_1").Range.Paste
End With
For convenience, the word bookmark name and the oleobject are the same. This code works ok, my problem is that i there are dozens of text box in dozens of worksheets so that when i write like this for each one i end up with lots of confusing code apart from the time it takes.
Do anyone now a code that could literary comand excel to chose all text boxes and copy is content to a bookmark with the exact same name? I was trying the For...next formula but i couldn«t make it work so i erased it.
Thanks in advance
Bookmarks