I am working on a program to automate MS Word from VB .NET. Most of the application is complete; however I need to automaticaly add the page number to the header. this is a section of my code.
Macro Recorder VBA:
My Code In VB .NET:Code:ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader ActiveDocument.AttachedTemplate.BuildingBlockEntries("Plain Number").Insert Where:=Selection.Range, RichText:=True ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Im not sure if I need to load the BuildingBlocks from a template or how but the error I get is:Code:oWord.ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekCurrentPageHeader oWord.ActiveDocument.AttachedTemplate.BuildingBlockEntries("Plain Number").Insert(Where:=oWord.Selection.Range, RichText:=True) oWord.ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekMainDocument
The requested member of the collection does not exist. (I'm sure this is in reference to "Plain Number")
Thank You For Your Help,
SGT Larry G. Ransom III
USA INF RET




Reply With Quote
