• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

Export in Word: Textmark doesn't exist

I do have a form with a button to export adress into a word.dot. opening the .dot works all fine. but by placing "Name" into the word-textmark "Name", i get an error saying, that the textmark does not exist. what is wrong on my code?

 oApp.Documents.Add Template:="X:\Vorlagen\Accessbrief.dot", NewTemplate:=False, DocumentType:=0
   
    'zu Textmarke springen und Namen einf├╝gen
   
    Set Bereich = oApp.ActiveDocument.GoTo(What:=GotoBookmark, Name:="name")
    Bereich.InsertAfter Forms!Adressanzeige!name

thx
ColumA        
0
ColumA
Asked:
ColumA
  • 3
  • 2
1 Solution
 
Ashen_ShugarCommented:

Have you tried renaming the TextMark in case Name is a reserved word?




Stephen
0
 
ColumAAuthor Commented:
Yes, Stephen, have tried several txtmarkwords.
0
 
PaurthsCommented:
hi, what happens if u give it a try like this:

Set Bereich = oApp.ActiveDocument.GoTo("name").Range
Bereich.InsertAfter Forms!Adressanzeige!name
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
ColumAAuthor Commented:
Hi Paurths

With your solution, I get runtime-error 4120 "Wrong Parameter".

0
 
PaurthsCommented:
oops... made an error, sorry
"GoTo" should be replaced by "Bookmarks"

try this


Set Bereich = oApp.ActiveDocument.Bookmarks("name").Range
Bereich.InsertAfter Forms!Adressanzeige!name
0
 
ColumAAuthor Commented:
gotcha. thank you Paurths.

Rgds
ColumA
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now