Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo,

ich habe ein kleines Problem in VBA. Wollte ein Sub schreiben, das mir ein bereits vorhandenes Objekt kopiert.

Ich erhalte als Fehlermeldung:

Object doesn't support this property or method.
Was die Meldung bedeutet weiß ich. Nur weiß ich nicht, warum sie dort erscheint...

Sub SubTestCopyObjects()

    Dim colObjects As Collection

    Dim Object1 As Class1

    Dim Object2 As Class1


    Set colObjects = New Collection

    Set Object1 = New Class1

    colObjects.Add Object1

    Set Object2 = New Class1

    Object2.CopyObjects (Object1)

End Sub
Mein Klassenmodul
Private iValue As Double

Private jValue As Double

Private kValue As Double


Sub setValues(i As Double, j As Double, k As Double)

iValue = i

jValue = j

kValue = k

End Sub


Sub CopyObjects(OldObject As Class1)

iValue = OldObject.iValue

jValue = OldObject.iValue

kValue = OldObject.iValue

End Sub

Hallo,

also so funktioniert es:

Private iValue As Double

Private jValue As Double

Private kValue As Double


Sub setValues(i As Double, j As Double, k As Double)

iValue = i

jValue = j

kValue = k

End Sub


Public Function FuncGetiValue() As Double

FuncGetiValue = iValue

End Function


Public Function FuncGetjValue() As Double

FuncGetjValue = jValue

End Function


Public Function FuncGetkValue() As Double

FuncGetkValue = kValue

End Function


Sub CopyObjects(OldObject As Class1)

iValue = OldObject.FuncGetiValue

jValue = OldObject.FuncGetjValue

kValue = OldObject.FuncGetkValue

End Sub
Sub SubTestCopyObjects()

    Dim colObjects As Collection

    Dim Object1 As Class1

    Dim Object2 As Class1


    Set colObjects = New Collection

    Set Object1 = New Class1

    colObjects.Add Object1

    Set Object2 = New Class1

    Call Object2.CopyObjects(Object1)


End Sub

Weiß jemand vielleicht noch eine Möglichkeit, wie ich ohne diese öffentlichen Get-Methoden auskomme?

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.