Am having problems with creating a Word document from Access. I have successfully created the document but cannot get Word to remain open in order to edit the document. Part of my coding is:
Problem is that Word closes, even though I reopen the saved document and place the cursor on a bookmark in it where I want the data to be entered (manually)
Would be grateful for anyone's help
Regards
Brian
NB have left out some non-relevant coding
Code:
DoCmd.OpenForm "frmSelectSchoolContact", , , "[fldSchool_ID] = " & Me.txtSchoolID, , acDialog
If Len(Me.txtSchoolName) < 10 Then
strFileName = Me.txtSchoolName & Me.txtSchoolID
Else
strFileName = Left(Me.txtSchoolName, 10) & Me.txtSchoolID
End If
appWord.Documents.Add strRoutePlanTemplateFolderName & "\" & strRoutePlanTemplate
appWord.Visible = True
appWord.Selection.GoTo wdGoToBookmark, NAME:="Name"
appWord.Selection.TypeText Me.txtSchoolName
appWord.Selection.GoTo wdGoToBookmark, NAME:="Phone"
appWord.Selection.TypeText Me.txtPhone
appWord.Selection.GoTo wdGoToBookmark, NAME:="Contact"
appWord.Selection.TypeText Me.txtContact
appWord.ActiveDocument.SaveAs strRoutePlanFolderName & "\" & strFileName
appWord.Documents.Open strRoutePlanFolderName & "\" & strFileName
appWord.Selection.GoTo wdGoToBookmark, NAME:="Start"
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblSchools SET tblSchools.fldRoutePlanner = " & strRoutePlanFolderName & "\" & strFileName & _
" WHERE ((tblSchools.fldSCHOOL_ID)= " & Me.txtSchoolID & ");"
DoCmd.SetWarnings True
DoCmd.Close
appWord.Quit
Set appWord = Nothing
Problem is that Word closes, even though I reopen the saved document and place the cursor on a bookmark in it where I want the data to be entered (manually)
Would be grateful for anyone's help
Regards
Brian
NB have left out some non-relevant coding