<customUI
xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="myxxk"
insertBeforeMso="TabHome"
label="我的选项卡">
<group id="cxgroup"
label="查询">
<box id="rxbox1"
boxStyle="vertical">
<box id="rxbox11"
boxStyle="horizontal">
<comboBox
id="ks_n"
label="开始日期:"
onChange="ksn_Click"
getItemCount="nCount"
getItemID="nID"
getItemLabel="nLabel"
getText="nMoren">
</comboBox>
<comboBox
id="ks_y"
sizeString=""
onChange="ksy_Click"
getItemCount="yCount"
getItemID="yID"
getItemLabel="yLabel"
getText="yMoren">
</comboBox>
</box>
<box id="rxbox21"
boxStyle="horizontal">
<comboBox
id="js_n"
label="结束日期:"
onChange="jsn_Click"
getItemCount="nCount"
getItemID="nID"
getItemLabel="nLabel"
getText="nMoren">
</comboBox>
<comboBox
id="js_y"
sizeString=""
onChange="jsy_Click"
getItemCount="yCount"
getItemID="yID"
getItemLabel="yLabel"
getText="yMoren">
</comboBox>
</box>
</box>
<button id="chaxun"
image="chaxun"
label=" 开始查询  "
size="large"
onAction="chaxun_click"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>

custom ui editor for microsoft office 打开excel中写入的代码

 '生成年份下拉框选项文本
Public ksrq As Date, jsrq As Date
Sub nCount(control As IRibbonControl, ByRef returnedVal)
returnedVal =
End Sub
Sub nID(control As IRibbonControl, index As Integer, ByRef id)
id = control.id & index
End Sub
Sub nLabel(control As IRibbonControl, index As Integer, ByRef returnedVal)
returnedVal = + index & "年"
End Sub '生成月份下拉框选项文本
Sub yCount(control As IRibbonControl, ByRef returnedVal)
returnedVal =
End Sub
Sub yID(control As IRibbonControl, index As Integer, ByRef id)
id = control.id & index
End Sub
Sub yLabel(control As IRibbonControl, index As Integer, ByRef returnedVal)
returnedVal = index + & "月"
End Sub '设置默认值
Sub nMoren(control As IRibbonControl, ByRef returnedVal)
returnedVal = IIf(Left(control.id, ) = "k", "2010年", "2015年")
End Sub
Sub yMoren(control As IRibbonControl, ByRef returnedVal)
returnedVal = IIf(Left(control.id, ) = "k", "1月", "12月")
End Sub '选择年月,保存到变量
Sub ksn_Click(control As IRibbonControl, text As String)
ksrq = DateSerial(Val(Left(text, )), Month(ksrq), )
End Sub
Sub ksy_Click(control As IRibbonControl, text As String)
ksrq = DateSerial(Year(ksrq), Val(LeftB(text, )), )
End Sub
Sub jsn_Click(control As IRibbonControl, text As String)
jsrq = DateSerial(Val(Left(text, )), Month(jsrq) + , )
End Sub
Sub jsy_Click(control As IRibbonControl, text As String)
jsrq = DateSerial(Year(jsrq), Val(LeftB(text, )) + , )
End Sub '点击查询按钮
Sub chaxun_click(control As IRibbonControl)
MsgBox "开始日期:" & Format(ksrq, "yyyy-mm-dd") & Chr() _
& "结束日期:" & Format(jsrq, "yyyy-mm-dd")
End Sub

vba中需要配合的代码

http://club.excelhome.net/forum.php?mod=viewthread&tid=709306&extra=page%3D1

excel怎样添加的选项卡中含有下拉列表的更多相关文章

  1. tabcontrol动态生成选项卡,并且在选项卡中添加窗体

    http://blog.csdn.net/zx13525079024/article/details/6084733 今天在论坛上看到有人问到,如果在点击TRVEVIEW时动态生成tabcontrol ...

  2. 在ASP.NET Core中添加的Cookie如果含有特殊字符,会被自动转义

    我们知道在Cookie中有些字符是特殊字符,这些字符是不能出现在Cookie的键值中的. 比如"="是Cookie中用来分隔键和值的特殊字符,例如:Key01=Value01,表示 ...

  3. Excel 2016 Power View选项卡不显示的问题

    https://zhuanlan.zhihu.com/p/43543442 PowerView是Excel中的Power系列插件之一,可以基于excel制作交互式仪表板. 初学者在使用Power Vi ...

  4. C# 将excel表格嵌入到Word中

    C# 将excel表格嵌入到Word中 继续开扒,今天要实现的是使用C#将excel表格嵌入到Word中这个功能,将word表格导入到excel中我已经写过了,如有需要可参考我之前的文章,在开始前还有 ...

  5. 基于MVC4+EasyUI的Web开发框架经验总结(6)--在页面中应用下拉列表的处理

    在很多Web界面中,我们都可以看到很多下拉列表的元素,有些是固定的,有些是动态的:有些是字典内容,有些是其他表里面的名称字段:有时候引用的是外键ID,有时候引用的是名称文本内容:正确快速使用下拉列表的 ...

  6. JQuery选择器中含有冒号的ID处理差异的分析

    问题提出 对于一个输入框, 如果其id中含有冒号(:),选择器使用需要有特殊写法, 例如 id为下 <input type="text" value="ddd&qu ...

  7. 对 url 中含有的中文进行转码操作

    对 url 中含有的中文进行转码操作 一般情况下,将带有中文的 url 拷贝到开发工具,开发工具都会有相应的转码(自动转码), 现在大部分的浏览器也可以对含有中文的 url 进行转码(自动转码) 情景 ...

  8. js方法参数中含有单引号双引号的处理

    最近在做项目时,遇到一个问题.当在js脚本中,拼接生成一个tr,然后添加到一个表格里. //假定testval是从后台传过来的数据 var testval = "含有'半角单引号的字符串&q ...

  9. 向C#的选项卡中添加自定义窗体

    一.自定义窗体的搭建 这个比较简单,添加一个WinForm窗体就行了,设置一个名字EditPanel,然后在窗体上画需要的控件. 二.将自定义窗体添加到选项卡 // 新建窗体加入到选项卡中 EditP ...

随机推荐

  1. spring+quartz报错:Table 'XXXX.QRTZ_TRIGGERS' doesn't exist

    Spring4.3.4 + quartz2.2.1配置到application.xml中 <properties> <spring.version>4.3.4.RELEASE& ...

  2. git--(3)分支 合并

    git branch test //新建分支 git branch //列出分支 git branch -r //列出远程分支 git branch -m | -M oldbranch newbran ...

  3. POI依据类型设置导出格式

    //设置Bigdecimal数据导出时以数值形式输出 CellStyle decimalStyle = workbook.createCellStyle(); DataFormat decimalDf ...

  4. 在做excel导出时如何将workbook直接写在输出流中

    参考网址 https://blog.csdn.net/u011109420/article/details/51330677 https://blog.csdn.net/u012116457/arti ...

  5. FTPserver

    客户端代码: import os import hashlib BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__) ...

  6. sqlite c#

    https://www.cnblogs.com/icebutterfly/p/7850689.html https://www.cnblogs.com/sdadx/p/7127098.html

  7. python 创建一次性,快速的小型web服务

  8. andorid 手机外部储存

    .xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android ...

  9. String 练习

    package com.hanqi; import java.util.Random; public class Text { public static void main(String[] arg ...

  10. Windows cordova build Error: Could not find gradle wrapper within Android SDK.(转)

    原文:http://blog.csdn.net/kongxx/article/details/68954151 在Windows7上运行 “cordova build Android” 报错,如下: ...