View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mariano B. Mariano B. is offline
external usenet poster
 
Posts: 9
Default Create Class Module using late binding

I have a code that creates a new workbook that has some macros within. One of
the is an event handler (I want some stuff to happen everytime a Pivot-Table
is updated).
I did it using early binding and it worked for me nut not to most of the
users. So I tried to switch to late binding.
I only need to know how to create a new class module.
Here is an example of what i did:

Sub Test1()
Dim module As Object
Set module = ThisWorkbook.VBProject.VBComponents.Add(1)
module.Name = "hola"
module.CodeModule.AddFromString ("'TESTING")


ThisWorkbook.VBProject.VBComponents.Item("ThisWork book").CodeModule.AddFromString ("'Just to see it works")
End Sub


Does anybody know how to get it done?
Thanks


--
Mariano