Update Cross Reference in Word from Excel


Active Member
Nov 21, 2011
Hello all,

I have an excel spreadsheet that i have added coding to fill out a word document. The current coding fills in a few text fields throughout the document. My issues is that there are a few points in the document i have filled with Cross Reference fields. The problem is when i run my macro, it fills in all the fields, but all the Cross Reference fields, don't changes. Can you please let me know what i need to add to my current code in order have all reference fields update.

Sub DRIMPAGR(rw As Long)

'Disable other sheet Events
Application.EnableEvents = False

Dim Wordapp As Word.Application
    Dim Location As Variant
    Dim lrow As Long
    Set FMws = ThisWorkbook.Worksheets("Final Map")
    Set Conws = ThisWorkbook.Worksheets("Contact")
    Set Wordapp = CreateObject("Word.Application")
    Dim wFile As String
    wFile = ActiveWorkbook.Path & "\Agreements\Improvement.Agr-2Party.docx"
    If Dir(wFile) <> "" Then
        Wordapp.Documents.Open (wFile)
        Wordapp.Visible = True
        MsgBox "File does not exists"
        'do actions
    End If
'Project Entry
If FMws.Cells(rw, "C").Value < 10000 Then
    If FMws.Cells(rw, "D").Value <> "" Then
        Wordapp.ActiveDocument.FormFields("TXProject").Result = "Tract " & FMws.Cells(rw, "C").Value & " Unit " & FMws.Cells(rw, "D").Value
        Wordapp.ActiveDocument.FormFields("TXProject").Result = "Tract " & FMws.Cells(rw, "C").Value
    End If
    If FMws.Cells(Target, "G").Value <> "" Then
        Wordapp.ActiveDocument.FormFields("TXProject").Result = "Parcel Map " & NOCws.Cells(rw, "C").Value & " Phase " & NOCws.Cells(rw, "D").Value
        Wordapp.ActiveDocument.FormFields("TXProject").Result = "Parcel Map " & NOCws.Cells(rw, "C").Value
    End If
End If

'Developer Name Information
Wordapp.ActiveDocument.FormFields("TXDeveloper").Result = FMws.Cells(rw, "G").Value

'Developer Entity Type
ContactNoc = IMPContFD(rw)

Wordapp.ActiveDocument.FormFields("TXEntity").Result = Conws.Cells(ContactNoc, "K").Value

'Planning Commission Date
Wordapp.ActiveDocument.FormFields("TXCouncilDate").Result = Format(FMws.Cells(rw, "K").Value, "mmmm dd, yyyy")

'Section 12.2 Contact Info
Wordapp.ActiveDocument.FormFields("TXAddress").Result = Conws.Cells(ContactNoc, "G").Value ' Addresss
Wordapp.ActiveDocument.FormFields("TXCSZ").Result = Conws.Cells(ContactNoc, "H").Value & ", " & Conws.Cells(ContactNoc, "I").Value & " " & Conws.Cells(ContactNoc, "J").Value 'City, State, Zip Entry
Wordapp.ActiveDocument.FormFields("TXPhoneNumber").Result = "(" & Conws.Cells(ContactNoc, "E").Value & ") " & Conws.Cells(ContactNoc, "F").Value 'Phone Number Entry
Wordapp.ActiveDocument.FormFields("TXEmail").Result = Conws.Cells(ContactNoc, "N").Value 'Email Address

'Tax ID # Entry
Wordapp.ActiveDocument.FormFields("TXTaxNumber").Result = Conws.Cells(ContactNoc, "L").Value 'Tax ID #

'Corporation Check
If Conws.Cells(ContactNoc, "M").Value = "Yes" Then
    Wordapp.ActiveDocument.FormFields("CKYes").CheckBox.Value = True
    Wordapp.ActiveDocument.FormFields("CKNo").CheckBox.Value = True
End If

'Review Message
MsgBox ("Please review Agreement Before Sending it to Engineer.")
FMws.Cells(rw, "X").Value = "X"

Application.EnableEvents = True

End Sub
Thank you for any assistance you can provide.

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...