Hi Everyone
From Excel I need to find out where I am in an open Word doc (table index and cell row,column)
This code works fine when run from Word but when run from Excel comes up with a runtime error 438 - "Object doesn't support this property or method"
on line starting "TableIndex ="
My Word & Excel are both 2003
Any comments and help appreciated
Thanks
Wayne
-----------------------------------------------------------------
Sub WhereAreWe()
Dim oDoc As Word.Document
Dim oWord As Word.Application
Set oApp = GetObject(, "Word.Application")
Set oDoc = oApp.ActiveDocument
' Which table are we in ?
TableIndex = oDoc.Range(0, Selection.Tables(1).Range.End).Tables.Count
' Which cell ?
CurrentRow = Selection.Information(wdStartOfRangeRowNumber)
CurrentColumn = Selection.Information(wdStartOfRangeColumnNumber)
MsgBox "Table Number: " & CStr(TableIndex) & vbCrLf _
& "Row Number: " & CStr(CurrentRow) & vbCrLf _
& "Column Number: " & CStr(CurrentColumn)
End Sub
----------------------------------------------------------------------
Bookmarks