I have set up some vba in access to create a word doc from a template and then populate the document using bookmarks - all works fine except when I try and create a second one and then get errors:-
If I close the word document first created then run again I get - "The remote server machine does not exist or is unavailable"
If I leave the first word doc open I get "Object variable or with block variable not set"
Error on "Set objdoc = word.Documents.Add ... " in below code presumably because the file is in use.
Code used - abbreviated but I only add more bookmarks with variables.
Dim objword As Object
Dim objdoc As Object
Set objword = CreateObject("Word.Application")
Set objdoc = word.Documents.Add("C\:Test.dotx", , False)
.Goto what:=wdGoToBookmark, Name:="BookMark1"
objword.Visible = True
Set objdoc = Nothing
Set objword = Nothing
Appreciate any ideas.