vb 实现传递 控件数组


Private Sub Command1_Click()
    Dim strLevelAdapt As String
    strLevelAdapt = "" 
  Call TransFormers.CheckBoxCapToWord( Check1 ,2)
  Debug.Print strLevelAdapt
End Sub
’-------------------------------
'TransFormers 模块
'将checkbox的选择转化成Word
Public Function CheckBoxCapToWord(ByRef CheckBoxP As Object,byval Number As Integer) As String 
'注意上面红色的字体位置就行了.
On Error GoTo errlst
    Dim ReturnValue As String
    ReturnValue = ""
    For i = 0 To Number  '对象划分
        If CheckBoxP(i).Value = 1 Then
            If ReturnValue = "" Then
                ReturnValue = CheckBoxP(i).Caption
            Else
                ReturnValue = ReturnValue & "|" & CheckBoxP(i).Caption
            End If
        End If
    Next
    CheckBoxCapToWord = ReturnValue
    Exit Function
errlst:
  Call WriteErrFile("TransFormers.CodeToWord():" + Err.Description)
    Err.Clear
    Resume Next
End Function

你可能感兴趣的:(vb)