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.

Some videos you may like

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Watch MrExcel Video

Forum statistics

Latest member

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...