Const .... Dim .... Set .... Call MyFunction1(var1,var2) Function MyFunction1(var1,var2) .... call MySub1(arg1) call MyFunction2(arg1,False) .... End function Sub MySub1(arg1) .... End Sub Function MyFunction2(arg1,arg2) .... call MyFunction3(....) End Function
Option Explicit Const cstDate = "15/05/2012" Const cstNumber = 10 Dim MyDate, MyNumber Main Sub Main Call ModifDate("+2",MyDate) Call ShowNewDate("+3", MyDate) MsgBox MyDate,,"Main -> ShowNewDate + 3 années" MsgBox MyNumber End Sub Function ModifDate(ArgDate, MyDate) MyDate = DateAdd("d",ArgDate, cstDate) MsgBox MyDate,,"ModifDate -> cstDate + 2 jours" ModifDate = MyDate End Function Function ShowNewDate(ArgDate, MyDate) MyDate = DateAdd("m",ArgDate, MyDate) MsgBox MyDate,,"ShowNewDate -> ModifDate + 3 mois" MyDate = DateAdd("yyyy",ArgDate, MyDate) MyNumber = cstNumber + 5 ShowNewDate = MyDate ShowNewDate = MyNumber End Function
Option Explicit Dim tmpsAcq Dim tmpsZ const r=0.2 Main Sub Main Call etape1 Call etape2 End Sub Function etape1 tmpsAcq = tmpsRef*(500/r*2) etape1 = tmpsAcq End Function Function etape2 tmpsZ=tempsAcq*05 'c'est justement lâ mon prblem comment appler tmpAcq? End Function
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionOption Explicit Dim tmpsAcq Dim tmpsZ const r=0.2 Main Sub Main Call etape1 Call etape2(tmpsAcq) MsgBox tmpsZ End Sub Function etape1() Dim tmpsRef tmpsRef = 2 tmpsAcq = tmpsRef*(500/r*2) etape1 = tmpsAcq End Function Function etape2(tmpsAcq) MsgBox tmpsAcq,,"contrôle var tmpsAcq" tmpsZ=tmpsAcq*05 'c'est justement lâ mon prblem comment appler tmpAcq? etape2 = tmpsZ End Functionjean-marc
Functionetape1() instruction instruction ... ... Function Integral() ...... ...... ...... end function instruction instruction ...... ...... end function
Option Explicit Dim tmpsAcq Dim tmpsZ const r=0.2 const tmpsRef = 2 'puis je les declarés içi alors q je vais les utilisé dans sub etapé? const tempselem=60 Main Sub Main Call etape1 Call etape2(tmpsAcq) MsgBox tmpsZ End Sub Function etape1() Dim tmpsRef Dim tempselem tmpsRef = 2 tempselem=60 tmpsAcq = tmpsRef*(500/r*2) etape1 = tmpsAcq End Function Function etape2(tmpsAcq) MsgBox tmpsAcq,,"contrôle var tmpsAcq" tmpsZ=tmpsAcq*05 etape2 = tmpsZ End Function
Option Explicit Const r=0.2 Const tmpsRef = 2 Const tempselem=60 Dim tmpsAcq,tmpsZ Call etape1 MsgBox tmpsZ Function etape1() tmpsAcq = tmpsRef*(500/r*2) Call etape2(tmpsAcq) End Function Function etape2(tmpsAcq) tmpsZ=tmpsAcq*05 etape2 = tmpsZ End Function
Option Explicit Const r=0.2 Const tmpsRef = 2 MsgBox tmpsRef*(500/r*2)*5
'######################################################### ' PARAMETRES SYSTEME '######################################################### Dim X Dim Xdp Dim Ydp Dim Y Dim Z Dim Z0 Dim Zn Dim X0 Dim Y0 Dim delta_x Dim delta_y Dim delta_z '######################################################### ' INITIALISATION DES PARAMETRES SYSTEME '######################################################### call deplacement() ' ***************************************************etape1************** Function Etape1() Dim t_Ref Dim MaxIndice Dim TableauIntensite Dim flag Dim tacq Dim t_Ref_r DIM Correction_factor '######################################################### '######################################################### ' INITIALISATION DES PARAMETRES UTILISATEURS '######################################################### delta_x=20 t_Ref=5 Correction_factor = 0.75 X=0 flag=1 '######################################################### '######################################################### Do ''lâ le rebor recoit un tableau de données MaxIndice=0 for i = 0 To UBound(TableauIntensite) If TableauIntensite(i)>TableauIntensite(MaxIndice) Then MaxIndice=i End If Next MaxIntensite=TableauIntensite(MaxIndice) If MaxIntensite<5 then flag=0 Else t_Ref=t_Ref*Correction_factor X= X+delta_x End if Loop Until flag=0 tacq= t_Ref/MaxIntensite etape1=tacq End Function sub etape2() Dim TabIntgral() Dim TabIntensite() Dim MaxIndiceSum Dim Temps_profil_Z Dim sumZ Dim Zstep Dim Z0 Dim Zn '######################################################### '######################################################### ' INITIALISATION DES PARAMETRES UTILISATEURS '######################################################### delta_x=10 delta_z=1 X0=0 Y0=0 Z0=-2 Zn=2 Zstep=1 rtz=0.5 'Facteur du temps de profil en Z pap au temps d'acquisition L=int(Zn-Z0)/Zstep ' (Zn-Z0)/Zstep en entier TempsZ=etape1()*5 '######################################################### '######################################################### X=X+delta_x for i= 1 to L+1 Z= Z0+(i-1)*delta_z acquisition des données ' Extraction des données dans un tableau TabIntensite sumZ=0 for j=1 to UBound(TabIntensite) sumZ=sumZ+(TabIntensite(j)-TabIntensite(1)) next ReDim Preserve TabIntgral(i) TabIntgral(i)= sumZ Next end sub '**************************************************etape3**************************** Function etape3 () Dim sumPhB Dim N Dim step_t Dim temps_Phb_elem Dim MaxIndicePhb Dim Tab_phb_Intensite Dim temps_phbl Dim delta_xphb Dim corr_tphb '######################################################### '######################################################### ' INITIALISATION DES PARAMETRES UTILISATEURS '######################################################### temps_Phblnchmn_elem= 5 step_p=1000 N= Int (temps_Phblnchmn_elem/step_p corr_tphb=200 Increment_phb=0.95 Seuil_phb=0.8 flag=0 delta_xphb=10 Do X=X+delta_Xphb For t=1 to N ' Extraction des donnees dans un tableau "Tab_phb_Intensite" sumPhB=0 for j=1 to UBound(Tab_phb_Intensite) ' sumPhB=sumPhB+Tab_phb_Intensite(j) next ReDim Preserve Tab_Phb_Intgral(t) Tab_Phb_Intgral(t)= sumPhB Next ee=UBound( Tab_Phb_Intgral) a= Tab_Phb_Intgral(ee-1) b= Tab_Phb_Intgral(ee) test= b/a etape3()=test end Function '**************************************************************deplacement********************************************************** sub deplacement() Dim Xx Dim ii Dim jj Dim kk Dim Nx Dim Ny Dim Nxx Dim NXy '######################################################### ' INITIALISATION DES PARAMETRES UTILISATEURS '######################################################### Xx =0 X0 =0 Y0 =0 Nx =3 Ny =2 Nxx=2 NXy=2 delta_x = 7000'grand X delta_xx= 100 delta_Xy= 100 delta_y = 7000 'grand Y for ii = 1 to Ny Y= Y0+(ii-1)*delta_y call etape2() call etape3() for jj = 1 to Nx X= X0+(jj-1)*delta_x call etape2() call etape3() for kk = 1 to Nxx Xx= X+(kk-1)*delta_xx +delta_x for ky = 1 to NXy Xy= Y+(ky-1)*delta_Xy+delta_Xy 'acquisition des données next next next next end sub