Open Word from Access and Select Insert (1 Viewer)

MiloC

New member
Local time
Today, 18:09
Joined
Jun 12, 2012
Messages
2
I am useing word mailmerge for reports and need to insert saved documents, breaks and bookmarks into other files depending on what is in the access data.

I am having trouble with Opening, Naming and Inserting the files.

Code:
Dim WordApp As Object
Set WordApp = CreateObject(Class:="Word.Application")
Dim objStewDoc As Word.Document
Set objStewDoc = WordApp.Documents.Open(StewDocName)
 
' Insert SubMapT.doc at SubMap BookMark in Word Document objStewDoc
      Set objStewDoc = Documents(1)
  With Documents(1)
      Selection.GoTo What:=wdGoToBookmark, Name:="SubMap"
      Selection.InsertFile fileName:=StewDir & "SubMapT.doc", Range:="", _
           ConfirmConversions:=False, Link:=False, Attachment:=False
  End With

I get Error 462 where I try to Set objStewDoc = Documents(1). Can someone please show me the proper code to do this insertion? Thanks
MiloC
 

Users who are viewing this thread

Top Bottom