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.

Funktionsaufruf mit Zählervariable

Empfohlene Antworten

Veröffentlicht

moin,

ich habe eine Funktion

On1

On2

...

On8

Die Funktionen möchte ich per Zufall aufrufen. Das heisst ich muss den Funktionsaufruf

On1
aufsplitten in
On & i
wobei i eine zufallszahl von 1-8 ist. ein bekannter hat mir folgenden befehl geschickt, der leider net funktioniert (Typen unverträglich):
Private Sub Command1_Click()

    Dim i As Long

    i = 1

    CallByName ("On" & i)

End Sub

kann mir wer helfen?

gruß

ein bisschen weiter bin ich jetzt gekommen...

Private Sub Command1_Click()

    Dim i As Long

    i = 1

    CallByName Me, "On" & i, VbMethod

End Sub
Wenn die Funktion in Me steht funktioniert das Ganze. Die Funktion On1 befindet sich jedoch in einem Modul (modSchalten) und
Private Sub Command1_Click()

    Dim i As Long

    i = 1

    CallByName modSchalten, "On" & i, VbMethod

End Sub

geht leider nicht

Wenn du der Funktion CallByName keiner Variablen zuweist, dann versuch es mal ohne Klammern, sollte in deinem Fall helfen.

Ausserdem hast du noch ein paar Attribute vergessen.

CallByName Objekt, "Prozedurname", Aufruftyp

Wenn du dies so anwendest, funktioniert es.

Gruß

djmcflow

Unterscheiden sich diese Funktionen, vom Namen mal abgesehen?

ja, vom inhalt ;)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.