ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
楼主: HHAAMM

[分享] 另类按钮(VBA交互脚本)!!!!

[复制链接]

TA的精华主题

TA的得分主题

 楼主| 发表于 2010-3-4 21:43 | 显示全部楼层
附件的功能是javascript语言实现的
再来个例子
sheet1的文本框里输入后点击验证,这也是javascript代码实现的

VBA交互脚本b.rar

13.96 KB, 下载次数: 50

TA的精华主题

TA的得分主题

 楼主| 发表于 2010-3-4 21:47 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
html,javascript代码解释

<script language="javascript"> 指定脚本语言是javascript
function abcd() 定义一个函数
{
alert("你输入的是: "+document.F1.T1.value);
document.F1.T1.value="";
}
</script>

<form name="F1" >
        <input type="text" name="T1" size="20">
        <input type="button" value="验证" onClick="abcd()"> 按钮调用函数
</form>

TA的精华主题

TA的得分主题

发表于 2010-3-4 22:11 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
下面的代码能否详细解释一下:

<html><head><title></title>
<style>
/* VBA交互脚本,HYY514 2010.1.28 */
.xmenu td{font-size:12px;font-family:verdana,arial;font-weight:bolder;color:#ffffff;border:1px solid #336699;background:#336699;filter:blendtrans(duration=0.5);cursor:hand;text-align:center}
</style>
</head>
<BODY scroll="no" oncontextmenu=self.event.returnValue=false>
<script type="text/javascript">
function attachXMenu(objid){
    var tds=objid.getElementsByTagName('td');
        alert("你好,这是个vba交互脚本的例子");
    for(var i=0;i<tds.length;i++){
        with(tds){
            onmouseover=function(){
                with(this){
                    filters[0].apply();
                    style.background='#ee0000';
                    style.border='1px solid #ffee00';
                    style.color='#ffff99';
                    filters[0].play();
                }
            }
            onmouseout=function(){
                with(this){
                    filters[0].apply();
                    style.background='#2B4DD5';
                    style.border='1px solid #66CCFF';
                    style.color='#ffffff';
                    filters[0].play();
                }
            }
        }
    }
}
</script>
<table class="xmenu" id="xmenu1" width="31%" height="100%" cellpadding="1" cellspacing="4" border="0" bgcolor="#ffffff"  >
<tr><td onclick="location.href='http://CommandButton1'" title="单击运行CommandButton1按钮">CommandButton1
<tr><td onclick="location.href='http://CommandButton2'" title="单击运行CommandButton2按钮">CommandButton2
<tr><td onclick="location.href='http://CommandButton3'" title="单击运行CommandButton3按钮">CommandButton3
<tr><td onclick="location.href='http://CommandButton4'" title="单击运行CommandButton4按钮">CommandButton4
<tr><td onclick="location.href='http://CommandButton5'" title="单击运行CommandButton5按钮">CommandButton5
<tr><td onclick="location.href='http://CommandButton6'" title="单击运行CommandButton6按钮">CommandButton6
<tr><td onclick="location.href='http://CommandButton7'" title="单击运行CommandButton7按钮">CommandButton7
<tr><td onclick="location.href='http://CommandButton8'" title="单击运行CommandButton8按钮">CommandButton8
<tr><td onclick="location.href='http://CommandButton9'" title="单击运行CommandButton9按钮">CommandButton9
</table>
<script>attachXMenu(xmenu1)</SCRIPT>
</BODY>
</html>

TA的精华主题

TA的得分主题

 楼主| 发表于 2010-3-4 22:14 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
再传个可以看明白的,html、javascript代码放在sheet2的a1里了(这个不要删除)

VBA交互脚本c.rar

13.31 KB, 下载次数: 67

TA的精华主题

TA的得分主题

 楼主| 发表于 2010-3-4 22:19 | 显示全部楼层
13楼,这是html代码+javascript代码,要详细解释
html 标记语言 不难的 自己搜搜看吧
javascript 是脚本语言

TA的精华主题

TA的得分主题

发表于 2010-3-5 00:22 | 显示全部楼层
太强大了,学过javascript,但是就是没有想到和VBA结合,要是拿这个来在VBA中设置界面,是不是会很fashion?

TA的精华主题

TA的得分主题

发表于 2010-3-5 08:07 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
高手处处可见,膜拜一个……

TA的精华主题

TA的得分主题

发表于 2010-3-6 08:36 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2010-3-6 09:52 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
很漂亮,记得论坛里的罗刚君版主是这方面的高手,他没当版主之前,show 过很多这方面的作品。

TA的精华主题

TA的得分主题

发表于 2010-3-6 10:52 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
老虎现在研究网页了。要是能将工作表中的浏览器控件又反馈到工作表里那就比较炫了。
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-6-14 01:45 , Processed in 0.035071 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表