Hi Everyone,
I need some help with Inserting A file into Word. I have a document that is a Offer Letter. Much of the text is cut and dry and I used the code below to take the data from Access and put it into the Word Offer Letter.

There are several places in the Offer letter where the paragraph used will be determined by another factor. In my case if a person is Hourly they have one paragraph inserted that pertains to them. If the person is Salary, they have a different paragraph inserted.

My problem is I am not sure how to go about making a selection in Access (where all my data is stored) and have it carry over to Word in the right location of the document.

I have my main document (OfferLTR.doc)
I also have a document that contains just the Hourly text (Hourly.doc)
I also have a document that contains just the Salary text (Salary.doc)

Here is the code I have so far. The code in RED is what I have been toying with but of course it does not work.

[VBA]Private Sub cmdOfferLtr_Click()
'Written by Helen Feddema 4-22-98
'Last modified 8-2-2000 by Jerry Dennison
On Error GoTo ErrorHandler
' Dim appWord As Word.Application - enable this line for early binding
Dim appWord As Object 'this line is for late binding, disable for early binding
' Dim docs As Word.Documents - enable this line for early binding
Dim docs As Object 'this line is for late binding, disable for early binding
Dim strLetter As String
Dim strTemplateDir As String
Dim prps As Object
Dim strDate As String
Dim strFileDir As String

Set appWord = GetObject(, "Word.Application")
strDate = CStr(Date)

If Me!PayType = 1 Then
strFileDir = "C:\HomeForms\"
Selection.InsertFile FileName:=strFileDir & "Hourly.doc"
Else
Selection.InsertFile FileName:=strFileDir & "Salary.doc"
End If

strTemplateDir = "C:\HomeForms\"
strLetter = strTemplateDir & "OfferLTR.doc"

Set docs = appWord.Documents
docs.Add strLetter

Set prps = appWord.ActiveDocument.CustomDocumentProperties

With prps
.Item("MasterID").Value = (Me!MasterID)
.Item("FormDate").Value = (Me!FormDate)
.Item("Salutation").Value = (Me!Salutation)
.Item("EmplFirstName").Value = (Me!EmplFirstName)
.Item("EmplMiddleInitial").Value = (Me!EmplMiddleInitial)
.Item("EmplLastName").Value = (Me!EmplLastName)
.Item("EmplAddress").Value = (Me!EmplAddress)
.Item("EmplCity").Value = (Me!EmplCity)
.Item("EmplState").Value = (Me!EmplState)
.Item("EmplZip").Value = (Me!EmplZip)
.Item("HiringCompany").Value = (Me!HiringCompany)
.Item("HourlyRate").Value = (Me!HourlyRate)
.Item("StartDate").Value = (Me!StartDate)
.Item("NoOfMonths").Value = (Me!NoOfMonths)


End With

With appWord
.Visible = True
.Activate
.Selection.WholeStory
.Selection.Fields.Update
.Selection.MoveDown 'this line should be disabled for early binding
'.Selection.MoveDown Unit:=wdLine, Count:=1 - this line should be enabled for early binding
End With
ErrorHandlerExit:
Exit Sub
ErrorHandler:
If Err = 429 Then
'Word is not running; open Word with CreateObject
Set appWord = CreateObject("Word.Application")
Resume Next
Else
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit
End If
End Sub
[/VBA]

I saw a post on this site where they used Autotext to insert specific paragraphs but do not think that will work here. Since I have all the data in Access I would like to have an all VBA solution.

If anyone can help me with the code to insert a file I would be very grateful. Also, the text in Hourly and Salary contain several docproperty fields. The question would be do I insert the file first then populate the properties or vis a versa.
Thanks,
Dom