Class file help

viper2843
08-22-2003, 04:15 PM
I need some help writing a program. I wrote a little demo program to ask for help. I need to pass the wApp to the class file.

Dim WithEvents wApp As Word.Application
Dim TestClass As Class1


Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
Set wApp = Application

Call TestClass.LoadToolbar(wApp)
End Sub

Here is the class file:

Public Sub LoadToolbar(ByVal HostApp As Application)
MsgBox ("Test")
End Sub

I am sort of new at this so can anyone help me?

John
08-22-2003, 04:33 PM
Change this:
Dim TestClass As Class1
to this:
Dim TestClass As New Class1

I think you need to do that for the Word.Application part as well.

What is the part where it says HostApp As Application? What is Application?

viper2843
08-22-2003, 04:58 PM
The Application will have to be whatever Application that I declare in the form. I am writting a program that needs to access the Word, Excel, and PowerPoint Object Libraries. Application is apart of each of those object libraries. Depending on which one is called HostApp has to be that Application.

BTW, with the things told me to do I get a type mismatch error.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum