When I run this I get "Dim appWD As Word.Application" highlighted and Compile Error: User defined type not defined. But I don't know why... boooohooooo

Sub InvoiceGenerator()

Dim strDate As String
Dim strMonth As String
Dim strProjectName As String
Dim strPONumber As String
Dim strInvoicenumber As String
Dim strjobnumber As String
Dim strsubtotal As String
Dim strvat As String
Dim strtotal As String
Dim i As Integer
Dim appWD As Word.Application

Set appWD = CreateObject("Word.Application.8")

i = 5

Do Until Cells(i, 9) = ""

    strInvoicenumber = Cells(i, 5)

    If Not strInvoicenumber = "" Then

        strDate = Cells(i, 4)
        strPONumber = Cells(i, 8)
            strjobnumber = Cells(i, 3)
            strProjectName = Cells(i, 9)
            strsubtotal = Cells(i, 12)
            strvat = Cells(i, 13)
            strtotal = Cells(i, 14)

appWD.Documents.Open Filename:="\\lgwsvr011\group9\\Projects-Everyone\51 Gatwick Airport Team\ECH\Invoicing\Invoices 2006\Invoice_Generator\InvoiceTemplate.doc"
appWD.ActiveDocument.Bookmarks("Date").Range = Format(strDate, "d mmmm yyyy")
appWD.ActiveDocument.Bookmarks("ProjectName").Range = strProjectName
appWD.ActiveDocument.Bookmarks("PONumber").Range = strPONumber
appWD.ActiveDocument.Bookmarks("InvoiceNumber").Range = strInvoicenumber
appWD.ActiveDocument.Bookmarks("JobNumber").Range = strjobnumber
appWD.ActiveDocument.Bookmarks("Month").Range = Format(strDate, "mmmm")
appWD.ActiveDocument.Bookmarks("SubTotal").Range = Format(strsubtotal, "£#,##0.00")
appWD.ActiveDocument.Bookmarks("VAT").Range = Format(strvat, "£#,##0.00")
appWD.ActiveDocument.Bookmarks("Total").Range = Format(strtotal, "£#,##0.00")
appWD.ActiveDocument.SaveAs Filename:="\\lgwsvr011\group9\\Projects-Everyone\51 Gatwick Airport Team\ECH\Invoicing\HAL\Invoices\" & strInvoicenumber & " - " & strProjectName, FileFormat:=0
appWD.ActiveDocument.Close

  i = i + 1
    
    Else
    
    i = i + 1

    End If
    
Loop
    
appWD.Quit

Set appWD = Nothing

 
End Sub