working with a com interface

  • Thread starter Thread starter barcrofter
  • Start date Start date
B

barcrofter

Im having vb6 transitional problems. Im trying to build an automation
interface to lotus wordpro in vb.net and after adding the reference to
wordpro to my project I find that I get only the interface.
e.g this approach works, where I create an object:

Dim wpApp As Object
wpApp = CreateObject("wordpro.application")

but I lose all the advantages of the type definition

But this alternative doesnt work:

Dim wpapp As Wordpro.WPApplication


gives me an error that Wordpro.WPApplication is an interface

Dim i% = lstFiles.SelectedIndex
Dim fn$ = lstFiles.Items(i)
Try
wpApp.OpenDocument(fn)
wpApp.ActiveDocWindow.visible = True
Catch ex As Exception
MsgBox("Open failed on document " + fn + " for " +
ex.Message)
End Try
 
You are only declaring a variable of <type>.

You need to instantiate it as well.

Dim wpapp As New Wordpro.WPApplication
===
 
Back
Top