Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 2601|回复: 16

[已解决]求多种办法

[复制链接]
发表于 2013-3-11 20:06 | 显示全部楼层 |阅读模式
打开总控平台.xlsm  将自动执行Book1.xlsm中a宏   见附件 总控平台.rar (11.73 KB, 下载次数: 3)
发表于 2013-3-11 20:13 | 显示全部楼层
搞不清楚你的目的,感觉思路有点复杂!!

回复

使用道具 举报

 楼主| 发表于 2013-3-11 20:22 | 显示全部楼层
无聊的疯子 发表于 2013-3-11 20:13
搞不清楚你的目的,感觉思路有点复杂!!

不复杂,下载文件——打开“总控平台”文件,就是一个打开指定文件执行指定红
里边的代码我不会改,求帮助
回复

使用道具 举报

发表于 2013-3-11 20:31 | 显示全部楼层
application.run方法。
如果不行就用APP来实现。
回复

使用道具 举报

发表于 2013-3-11 20:35 | 显示全部楼层
Application.Run 方法
运行一个宏或者调用一个函数。该方法可用于运行用 Visual Basic 或 Microsoft Excel 宏语言编写的宏,或者运行 DLL 或 XLL 中的函数。
语法

表达式.Run(Macro, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

表达式   一个代表 Application 对象的变量。
回复

使用道具 举报

 楼主| 发表于 2013-3-11 20:36 | 显示全部楼层
hwc2ycy 发表于 2013-3-11 20:31
application.run方法。
如果不行就用APP来实现。

附件中用到了application.run,麻烦老师看我的问题。
回复

使用道具 举报

发表于 2013-3-11 20:37 | 显示全部楼层
至于遍历代码,就是用代码操作VBE了。

回复

使用道具 举报

发表于 2013-3-11 20:38 | 显示全部楼层
  1. Sub ListComponents(ByRef Wb As Workbook)
  2.     Dim VBComp As Object
  3.     For Each VBComp In Wb.VBProject.VBComponents
  4.         If Not VBComp.CodeModule Is Nothing Then
  5.             Call RemarkSub(VBComp.CodeModule)
  6.         End If
  7.     Next
  8. End Sub

  9. Sub RemarkSub(ByRef CodeModule As Object)
  10.     Dim i&
  11.     With CodeModule
  12.         If .countoflines - .CountOfDeclarationLines <= 0 Then Exit Sub
  13.         For i = 1 To .countoflines
  14.             .ReplaceLine i, "'" & .Lines(i, 1)
  15.         Next
  16.     End With
  17. End Sub
复制代码
这是注释代码用的过程。
回复

使用道具 举报

发表于 2013-3-11 20:44 | 显示全部楼层
你直接把那个要换的删除了,生新加一个窗体中的按钮。
回复

使用道具 举报

 楼主| 发表于 2013-3-11 20:45 | 显示全部楼层
hwc2ycy 发表于 2013-3-11 20:38
这是注释代码用的过程。

老师我们一个一个来好吗?
总控平台中,我用到Application.Run "Book1.xlsm!Sheet1.CommandButton1_Click",CommandButton1_Click能否换成表单按钮?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-4-27 02:25 , Processed in 0.848046 second(s), 10 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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