注册 登录
编程论坛 VB6论坛

代码怎么修改?

asad 发布于 2019-12-06 22:50, 1616 次点击
Set d = CreateObject("scripting.dictionary")
        r = Range("h" & Rows.Count).End(xlUp).Row
        arr = Range("w5:ay" & r)
        ReDim brr(1 To UBound(arr), 1 To 3)
        For i = 1 To UBound(arr)
            If Not d.Exists(s) Then
                m = m + 1
                d(s) = m
                brr(m, 1) = s
                brr(m, 2) = 1
                brr(m, 3) = arr(i, 1)
            Else
                brr(d(s), 2) = brr(d(s), 2) + 1
                brr(d(s), 3) = brr(d(s), 3) + arr(i, 1)
            End If
        Next
        For i = 1 To m
            n = n + 1
            brr(i, 1) = n
            brr(i, 2) = brr(i, 2) & "a"
            brr(i, 3) = brr(i, 3) & "b"
        Next
想用datagrid来显示brr(i, 1) brr(i, 2) brr(i, 3) 3列数据,这代码怎么修改?
2 回复
#2
asad2019-12-20 10:23
Option Explicit
Implements IRibbonExtensibility '添加对 IRibbonExtensibility 接口的引用

Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
    Set xlapp = Application '加载时
End Sub

Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
    Set xlapp = Nothing '卸载时
End Sub

'调用自定义 XML
Public Function IRibbonExtensibility_GetCustomUI(ByVal RibbonID As String) As String
    IRibbonExtensibility_GetCustomUI = GetRibbonXML()
End Function

'添加 XML 自定义代码
Public Function GetRibbonXML() As String
    Dim sRibbonXML As String
    sRibbonXML = "<customUI xmlns=""http://schemas. >" & _
                    "<ribbon startFromScratch=""false"">" & _
                        "<tabs>" & _
                            "<tab id=""hd"" label=""数据"">" & _
                                "<group id=""eh"" label=""数据"">" & _
                                    "<button id=""Button1"" label=""数据1"" size=""large"" imageMso=""HappyFace"" onAction=""a1"" />" & _
                                    "<button id=""Button2"" label=""数据2"" size=""large"" imageMso=""FormulaMoreFunctionsMenu"" onAction=""a2"" />" & _
                                    "<button id=""Button3"" label=""数据3"" size=""large"" imageMso=""FunctionsDateTimeInsertGallery"" onAction=""a3"" />" & _
                                "</group>" & _
                                "<group id=""sh"" label=""数据"">" & _
                                    "<button id=""Button4"" label=""数据4"" size=""large"" imageMso=""FindDialog"" onAction=""a4"" />" & _
                                    "<button id=""Button5"" label=""数据5"" size=""large"" imageMso=""FilterToggleFilter"" onAction=""a5"" />" & _
                                "</group>" & _
                                "<group id=""fh"" label=""数据"">" & _
                                    "<button id=""Button6"" label=""数据6"" size=""large"" imageMso=""BlogHomePage"" onAction=""a6"" />" & _
                                    "<button id=""Button7"" label=""数据7"" size=""large"" imageMso=""HyperlinkInsert"" onAction=""a7"" />" & _
                                "</group>" & _
                                "<group id=""ch"" label=""数据"">" & _
                                    "<button id=""Button8"" label=""数据8"" size=""large"" imageMso=""Calculator"" onAction=""a8"" />" & _
                                    "<button id=""Button9"" label=""数据9"" size=""large"" imageMso=""DeclineInvitation"" onAction=""a9"" />" & _
                                "</group>" & _
                            "</tab>" & _
                        "</tabs>" & _
                    "</ribbon>" & _
                 "</customUI>"
    GetRibbonXML = sRibbonXML
End Function
   
Public Sub a1(ByVal control As IRibbonControl)
   
End Sub
#3
asad2019-12-20 10:28
Public Function GetRibbonXML() As String
    Dim sRibbonXML As String
    sRibbonXML = "<customUI xmlns=""http://schemas. >" & _
                    "<ribbon startFromScratch=""false"">" & _
                        "<tabs>" & _
                            "<tab id=""caidan"" label=""数据"">" & _
                                "<group id=""zidingyi"" label=""数据"">" & _
                                    "<menu id=""menu1"" label=""数据""  size=""large"" itemSize=""large"" imageMso=""HappyFace"">" & _
                                        "<menuSeparator id=""rxmSep01"" title=""数据"" />" & _
                                            "<button id=""Button1"" label=""数据1"" imageMso=""HappyFace"" onAction=""a1"" />" & _
                                            "<button id=""Button2"" label=""数据2"" imageMso=""FormulaMoreFunctionsMenu"" onAction=""a2"" />" & _
                                            "<button id=""Button3"" label=""数据3"" imageMso=""FunctionsDateTimeInsertGallery"" onAction=""a3"" />" & _
                                        "<menuSeparator id=""rxmSep02"" title=""数据"" />" & _
                                            "<button id=""Button4"" label=""数据4"" imageMso=""FindDialog"" onAction=""a4"" />" & _
                                            "<button id=""Button5"" label=""数据5"" imageMso=""FilterToggleFilter"" onAction=""a5"" />" & _
                                        "<menuSeparator id=""rxmSep03"" title=""数据"" />" & _
                                            "<button id=""Button6"" label=""数据6"" imageMso=""BlogHomePage"" onAction=""a6"" />" & _
                                            "<button id=""Button7"" label=""数据7"" imageMso=""HyperlinkInsert"" onAction=""a7"" />" & _
                                        "<menuSeparator id=""rxmSep04"" title=""数据"" />" & _
                                            "<button id=""Button8"" label=""数据8"" imageMso=""Calculator"" onAction=""a8"" />" & _
                                            "<button id=""Button9"" label=""数据9"" imageMso=""DeclineInvitation"" onAction=""a9"" />" & _
                                    "</menu>" & _
                                "</group>" & _
                            "</tab>" & _
                        "</tabs>" & _
                    "</ribbon>" & _
                 "</customUI>"
    GetRibbonXML = sRibbonXML
End Function
1