working with a com interface

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
 
S

Stephany Young

You are only declaring a variable of <type>.

You need to instantiate it as well.

Dim wpapp As New Wordpro.WPApplication
===
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top