本文介绍了我想调用一个“返回”的函数。几个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想调用一个返回的函数。几个值 - 所有

都与表单上的过程需求相关。我这么做了。
明白FN会返回一个值。


我想知道,这是一个雇用用户定义的好地方输入?


FN将驻留在全局模块中。当被调用时,它确实返回

一个被认为是最重要的值。但是当它正在运行时,

它会计算几个更重要的值,否则在处理时需要在调用函数中重新计算


返回那里。评论?

I would like to call a function that "returned" several values - all
of which are relevant to the needs of a procedure on a form. I do
understand that FN''s return a single value.

I''m wondering, is this a good place to employ a user-defined Type?

The FN would reside in a global module. When called, it does return
one value considered to be the most important. But while it''s running,
it does calculate several more important values that would otherwise
have to be REcalculated in the calling function when processing
returns there. Comments?

推荐答案




公共功能MyHeroes(ByVal p1,ByVal p2)As Variant

Dim a(6)As Variant

a(0)= UCase(p1)

a(1)= LCase(p1)

a(2)= StrConv(p1,vbProperCase)

a(3)= UCase(p2)

a(4)= LCase(p2)

a(5)= StrConv(p2,vbProperCase)

MyHeroes = a

结束功能


子测试()

Dim r As Variant

r = MyHeroes(giLbert a HIGHet,harry s Truman)

Debug.Print r(0)

Debug.Print r(1)

Debug.Print r(2)

Debug.Print r(3)

Debug.Print r(4)

Debug.Print r(5)


''GILBERT A HIGHET

''gilbert a highet

''Gilbert A Highet

''HARRY S TRUMAN

''harry s truman

''Harry S Truman


结束分


-

lyle fairfield

Public Function MyHeroes(ByVal p1, ByVal p2) As Variant
Dim a(6) As Variant
a(0) = UCase(p1)
a(1) = LCase(p1)
a(2) = StrConv(p1, vbProperCase)
a(3) = UCase(p2)
a(4) = LCase(p2)
a(5) = StrConv(p2, vbProperCase)
MyHeroes = a
End Function

Sub test()
Dim r As Variant
r = MyHeroes("giLbert a HIGHet", "harry s Truman")
Debug.Print r(0)
Debug.Print r(1)
Debug.Print r(2)
Debug.Print r(3)
Debug.Print r(4)
Debug.Print r(5)

''GILBERT A HIGHET
''gilbert a highet
''Gilbert A Highet
''HARRY S TRUMAN
''harry s truman
''Harry S Truman

End Sub

--
lyle fairfield



这篇关于我想调用一个“返回”的函数。几个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 22:01