Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Function CreateWordLetter(strDocPath As String)
'function returns nothing, but I created this as a
'function so all those macro users out there could
'use it also. :P
'if no path is passed to function, exit - no further
'need to do anything
If IsNull(strDocPath) Or strDocPath = "" Then
Exit Function
End If
Dim dbs As Database
Dim objWord As Object
Dim PrintResponse
Set dbs = CurrentDb
'create reference to Word Object
Set objWord = CreateObject("Word.Application")
'Word Object is created - now let's fill it with data.
With objWord
.Visible = True
.Documents.Open(strDocPath)
'move to each bookmark, and insert correct text.
.ActiveDocument.Bookmarks("<bookmark name>".Select
.Selection.Text=(Cstr(Forms!<form name>!<field
name>))
.ActiveDocument.Bookmarks.Add Name:=<bookmark name>,
Range = Selection.Range
** continue the ActiveDocument and Selection statements for each bookmark that you have on the Word Document **
End With
'find out if the user would like to print the document
'at this time.
PrintResponse = MsgBox("Print this document?", vbyesno)
If PrintResponse = vbYes Then
objWord.ActiveDocument.PrintOut Background:=False
End If
'release all objects
Set objWord = nothing
Set dbs = nothing
End Function