This project has moved and is read-only. For the latest updates, please go here.

Word new document instance

Apr 1, 2014 at 7:18 PM
Edited Apr 1, 2014 at 7:33 PM
Hi, I've got this question, I'm using this code

Private oWord As Word.Application()

then instancing oWord like this

Private Sub NuovoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NuovoToolStripMenuItem.Click
    Dim oWord = New Word.Application()
    oWord.DisplayAlerts = WdAlertLevel.wdAlertsAll

    Dim oWordDoc As New Word.Document()
    oWordDoc = oWord.Documents.Add()

    oWord.Visible = True

End Sub

then I would like to use the same instance like this
Protected Sub mnuRtime_Click(ByVal sender As Object, ByVal e As EventArgs)

    Dim s As ToolStripMenuItem = CType(sender, ToolStripMenuItem)

    oWord.Selection.TypeText(s.Tag) <-----BUT IT SAYS THAT 'Selection' is not meber of 'System.Array'

End Sub
Anyway, the fact is that I would like to use the created document from other function, events.

Otherwise, how can I write on the active doument on the screen?

Thanks in advance