View Single Post
 
Old 04-04-2017, 06:59 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I see no indication that either of the suggestions in my previous reply have been implemented.

As for the Access code in your sample DB, there's nothing inherently 'wrong' with it, though I note that what you're calling a template is actually a document - and that you're opening it as such. A Word template would have a .dotx extension and you'd create a new file from it via the .Documents.Add method.

Regarding the code you originally posted at AccessForums, I note you had a problem with this line:
Set wrdRange = wrdDoc.GoTo(What:=wdGoToBookmark, Name:="Item")
That could, of course, occur if the document lacked such a bookmark, besides with it would be more efficient to replace all of:
Code:
Set wrdRange = wrdDoc.GoTo(What:=wdGoToBookmark, Name:="Item")
    wrdRange.Select
    wrdRange.InsertAfter TranslationItem
with:
Code:
wrdDoc.Bookmarks("Item").Range.InsertAfter TranslationItem
and, as a safeguard against errors caused by missing bookmarks, you might use:
Code:
With wrdDoc
  If .Bookmarks.Exists("Item") Then .Bookmarks("Item").Range.InsertAfter TranslationItem
End with
PS: Kindly don't start new threads on the same topic. I've moved you latest post into the original thread.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote