Hi all,
Using Visual Studio Pro 2008
Office Pro 2007
I am working through some tutorials from VSTO For Mere Mortals
I created a Class:
Public Class Sentence Private TextValue As String Property Text() As String Get Return TextValue End Get Set(ByVal value As String) TextValue = value End Set End Property End Class
And I tried to Insantiate it
The word "Sentence" is underlined with a blue squiggly linePrivate Sub ThisDocument_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup Dim Sentence1 As New Sentence() Dim Sentence2 As New Sentence() Sentence1.Text = "This is my first sentence. " Sentence2.Text = "This is my second sentence. " Me.Paragraphs(1).Range.InsertAfter( _ Sentence1.Text & Sentence2.Text) End Sub
The error message is Type 'Sentence' is not defined.
What am I doing wrong?
Thanks,
Winston
thanks
-goss
Solved.
I think I must have created a global class directly under "Solution" in Solution Explorer
I started a new project, and this time created the class within the word document and then added the code to the startup handler
Works great
thanks
-goss
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks