Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Class module creating OLEObject
I recorded the following macro, and it works.
-=- Sub Macro1() Dim ooo As Object Set ooo = ActiveSheet.OLEObjects.Add(Filename:= _ "C:\Documents and Settings\neuwirth\My Documents\Watermark.pdf", _ Link:=False , DisplayAsIcon:=False) End Sub -=- Now I created a new class module named myobj which contains -=- Dim WithEvents oleobj As OLEObject Sub Class_Initialize() Set oleobj = ActiveSheet.OLEObjects.Add(Filename:= _ "C:\Documents and Settings\neuwirth\My Documents\Watermark.pdf", _ Link:=False , DisplayAsIcon:=False) End Sub -=- Then I defined a macro -=- Sub testit() Dim mypdf As myobj Set mypdf = New myobj End Sub -=- testit does not run, I get an error Run time error 459 Object or class does not support the set of events. I do not understand this. Can anybody help me? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating UDF by Class Module (Leo)? | Excel Discussion (Misc queries) | |||
CLASS MODULE & SIMPLE MODULE | Excel Discussion (Misc queries) | |||
let and get in class module | Excel Programming | |||
Class module | Excel Programming | |||
Variable from a sheet module in a class module in XL XP | Excel Programming |