Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating UDF by Class Module (Leo)? Leo Excel Discussion (Misc queries) 1 December 2nd 08 10:59 AM
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
let and get in class module Doug Glancy Excel Programming 3 June 30th 04 02:30 PM
Class module David Excel Programming 4 December 31st 03 01:58 PM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM


All times are GMT +1. The time now is 04:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"