christer99
IS-IT--Management
- Dec 3, 2001
- 247
How do I create a reference to wdGoToPage? What is missing? Why are all program examples with out references and why do I do this in Visual Studio 2003?
I can compile the code (build the application), but when I run it I am getting this error:
Public member 'wdGoToPage' on type 'DocumentClass' not found.
Imports Word = Microsoft.Office.Interop.Word
Public Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim oWord As Word.Application
Dim oDoc3 As Word.Document
oDoc3 = oWord.Documents.Add("J:\VBProposalTemplates\surplus4.dot")
oDoc3.Content.Copy()
Dim activeFile As String
oDoc3.Activate()
Dim rad As Word.Range
oWord.Selection.GoTo(What:=oDoc3.wdGoToPage, Which:=oWord.wdGoToNext, Name:="3")
oWord.ActiveDocument.Bookmarks.Add(Name:="temp1", Range:=oWord.Selection.Range)
oDoc3.Selection.GoTo(What:=oWord.wdGoToPage, Which:=oWord.wdGoToNext, Name:="6")
rad = oWord.ActiveDocument.Range(Start:=oWord.ActiveDocument.Bookmarks("temp1").Range.Start, _
End:=oWord.ActiveDocument.Bookmarks("\page").Range.End)
End sub
I can compile the code (build the application), but when I run it I am getting this error:
Public member 'wdGoToPage' on type 'DocumentClass' not found.
Imports Word = Microsoft.Office.Interop.Word
Public Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim oWord As Word.Application
Dim oDoc3 As Word.Document
oDoc3 = oWord.Documents.Add("J:\VBProposalTemplates\surplus4.dot")
oDoc3.Content.Copy()
Dim activeFile As String
oDoc3.Activate()
Dim rad As Word.Range
oWord.Selection.GoTo(What:=oDoc3.wdGoToPage, Which:=oWord.wdGoToNext, Name:="3")
oWord.ActiveDocument.Bookmarks.Add(Name:="temp1", Range:=oWord.Selection.Range)
oDoc3.Selection.GoTo(What:=oWord.wdGoToPage, Which:=oWord.wdGoToNext, Name:="6")
rad = oWord.ActiveDocument.Range(Start:=oWord.ActiveDocument.Bookmarks("temp1").Range.Start, _
End:=oWord.ActiveDocument.Bookmarks("\page").Range.End)
End sub