Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Excel OLEObject Control (https://www.delphipraxis.net/7836-excel-oleobject-control.html)

neolithos 22. Aug 2003 14:28


Excel OLEObject Control
 
Ich hab ein Excel-Blatt, welches ich leicht erweitert habe.

Der Programm-Code für die Erweiterung steht in einer ActiveX-Dll.

Mein Problem:
Ich brauche von einer ListBox das Erreignis LostFocus, welches in
Excel.OLEObject declariert wurde.

Damit ich das OLE-Object erhalte suche nach dem mit der Folgenden
Function.


Code:
Public Function FindOleObject(ByVal wks As Worksheet, ByVal aCtrl As Object) As Excel.OLEObject
' sucht zu diesem Excel-Control das dazugehörige OLE-Object
Dim oOLE As Excel.OLEObject
Dim I As Integer
    For I = 1 To wks.OLEObjects.Count
        Set oOLE = wks.OLEObjects(I)
        If oOLE.Name = aCtrl.Name Then
            Set FindOleObject = oOLE
            Exit Function
        End If
    Next
    Err.Raise 10000, "FindOleObject", "Zum Control konnte keine OLEObject zugeordnet werden..."
End Function
Dies Funktioniert ervoragend...

Aber:

Code:
Private WithEvents lstO as Excel.OLEObject

   set lstO = FindOleObject(worksheet, lstSaBe)
bei dieser Zuweisung erhalte ich den Fehler:
Objekt oder Klasse unterstützt diese Ereignismenge nicht.


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:17 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz