How to add a Word.WdFieldType to a word table with vb.net
Eugene Gough
196
Reputation points
I am creating a document that needs a header with the build date, page number and total pages. Word has several functions that will do that but attempts to use them in a table causes a run time error from Interop,
{"This command is not available."} Note that I know the table is valid as the "test" shows up in the proper cell if the add field is disabled.
Simple example of the failure
Dim tbrng As Word.Range = table1.Rows(rowCount).Cells(1).Range
tbrng.InsertAfter("test")
tbrng.Fields.Add(tbrng, Word.WdFieldType.wdFieldDate)
Sign in to answer