vba的function是什么,为什么定义一个数组,就让我写function。还有split的用法

vba的function是什么,为什么定义一个数组,就让我写function。还有split的用法。
比如dim a() as string

function是有返回值的函数,是最基本的概念。一般用函数名=值的方式来返回。

split是分割字符串,建议网上搜一下,你这些问题都容易搜到答案。
你可以先下载个vb6.0来练习一下vb的语法。追问

split分割一个变量,然后用的是vbcrlf我记得是这种特殊的定义,一般怎么用,

追答

那就是把多行分割为行的数组。

追问

问最后一个,没事把。我们工作时,xls里面的代码已经写好,他们都放在了,excel工具栏里点,怎么做到的

追答

参考一下我写的代码:

Sub MakeMenu()
'   Creates a new menu and adds menu items
    Dim Cap(1 To 15)
    Dim Mac(1 To 15)
    Dim NewMenu As CommandBarControl
    Dim Item As CommandBarControl
    Dim MenuCount As Integer
    Dim I As Integer
    
    Cap(1) = "»ã×Ü"
    Mac(1) = "CalcInOutTotal"


'   Delete the menu if it already exists
    On Error Resume Next
    Application.CommandBars(1).Controls("³öÈë¿â").Delete
    On Error GoTo 0
    
'   Add the menu
    MenuCount = Application.CommandBars(1).Controls.Count
    Set NewMenu = Application.CommandBars(1).Controls.Add(Type:=msoControlPopup, Before:=MenuCount, temporary:=True)
    NewMenu.Caption = "&³öÈë¿â"
    
'   Add the menu items
    For I = 1 To 1
        Set Item = NewMenu.Controls.Add(Type:=msoControlButton, temporary:=True)
        With Item
            .Caption = Cap(I)
            .OnAction = Mac(I)
            If I Mod 4 = 0 Then .BeginGroup = True
        End With
    Next I
End Sub

追问

很感谢,采纳了,不过那个6.0 vba练习语法的是什么,软件么?

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-04-22
多学习VBa语法啊追问

。。。。虽然你等于没说一样。。。

追答

嘿嘿嘿嘿

相似回答