Parametre d une functtion

oliverr22 - 15 janv. 2001 à 12:17
 oliverr22 - 15 janv. 2001 à 14:51
bonjour
j ai un probleme pour passer un tableau en parametre d une fonction...
ex:
Function Toto( T) as string

T etant un tableau défini dans mon prog principal comme ceci:
SUb progprinc()
Dim T(1 to 10) as string
end sub

merci

2 réponses

Jette un oeil à cela:

Dim myarray(1 To 10)

Private Sub Form_Click()
Me.Caption = myarray(2)
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
Toto myarray
End Sub

Public Function Toto(TheArray As Variant)
Beep
TheArray(2) = TheArray(2) + 1
End Function

A++ sur www.lesiteweb.fr.st
0
moi je le fais sous Excel, et j ai déclaré des types de structure dans le module comme ceci:
Type libelle
refprod As String
libprod As String
End Type

et je veux envoyer mon tableau de type libelle en parametre de ma fonction toto comme ceci:

Function rempTab(T As libelle)

Dim i As Integer

For i = 1 To 5
T(i).refprod = InputBox("entrez la référence n°" & i)
T(i).libprod = InputBox("entrez le libellé n°" & i)
Next

End Function
Sub princ()

Dim T(1 To 5) As libelle
Dim c As libelle
rempTab (T)
MsgBox (T(2).refprod)
End Sub
0
Rejoignez-nous