In Microsoft Office Excel 2003, I am attempting to run an Excel macro which executed successfully with an earlier version of Excel, but does not execute now. I get a Microsoft Visual Basic Compile error: Variable not defined" message at the wdWindowStateMinimize statement. What needs to be done so that the variable is recognized when I attempt to execute the macro?
Private Sub automateWord(wsTemp As Worksheet, wsList As Worksheet, FilePath As String)
'Either gets a new instance of Word or uses the existing instance of Word.
Dim myDoc, oWord As Object
On Error GoTo erroh
Set oWord = GetObject(, "Word.application")
oWord.Visible = True
oWord.WindowState = wdWindowStateMinimize
Private Sub automateWord(wsTemp As Worksheet, wsList As Worksheet, FilePath As String)
'Either gets a new instance of Word or uses the existing instance of Word.
Dim myDoc, oWord As Object
On Error GoTo erroh
Set oWord = GetObject(, "Word.application")
oWord.Visible = True
oWord.WindowState = wdWindowStateMinimize