I try to achieve the following thing: Copy string elements from an excel cell to a bookmark in word. There a user can modify the strings and can after modification send the strings back to excel.
My Problem: I can copy the strings over to the bookmarks (bookmars are set as enclosing bookmarks in word, means that i have a just written 'abc' where the bookmark should be, marked 'abc' and pressed bookmark.) the bookmarks are still there after copying the text but when I try to write the strings at the bookmarks back to excel the .Range-Object is empty.
My Question: Could anyone help me accomlish my goal to get the strings back from the bookmarks to excel. Therefore I just need the string in an object or so. A msgbox(the_string) is enought I can put it then to the place in excel where it belongs.
Here is my code:
Sub BM(Step As Byte)
Dim docApp As Word.Application
Dim CurrentDoc As Word.Document
Set docApp = GetObject(, "word.application")
Set CurrentDoc = docApp.ActiveDocument
CurrentDoc.Bookmarks(Step & "Number").Range.Select
Dim objBMRange_pos As Word.Range
Set objBMRange_pos = CurrentDoc.Bookmarks(Step & "Number").Range
Dim oData As dataobject
Set oData = New dataobject
oData.SetText ""
'The function Check_A delivers the string from excel cells
oData.SetText Check_A(Step, "Number")
oData.PutInClipboard
oData.GetFromClipboard
CurrentDoc.Bookmarks(Step & "Number").Range.Text = oData.GetText
'CurrentDoc.Parent.Selection.PasteSpecial DataType:=wdPasteText
'Re-new the bookmarks
CurrentDoc.Bookmarks.Add Name:=(Step & "Number"), Range:=objBMRange_pos
Debug.Print CurrentDoc.Bookmarks(Step & "Number").Range.Text
End Sub