- 1、本文档共10页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Vba代码自动缩进功能的实现
Vba代码自动缩进功能的实现
喜欢Vba的朋友到知道:编写宏代码时,如果代码一多,就觉得杂乱无章,没有条理性.如何进行代码自动缩进,就成了紧迫的问题.
下面就介绍实现此功能的DLL文件的编译过程:
编译环境:vb6.0,office2000,Excel2000
编译步骤:
(一)把下面代码保存为Connect.Dsr文件:
VERSION 5.00
Begin {AC0714F6-3D04-11D1-AE7D-00A0C90F26F4} Connect
ClientHeight = 6300
ClientLeft = 1740
ClientTop = 1545
ClientWidth = 11130
_ExtentX = 19632
_ExtentY = 11113
_Version = 393216
Description = Add-In Project Template
DisplayName = My Add-In
AppName = Microsoft Excel
AppVer = Microsoft Excel 9.0
LoadName = Startup
LoadBehavior = 3
RegLocation = HKEY_CURRENT_USER\Software\Microsoft\Office\Excel
End
Attribute VB_Name = Connect
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Private WithEvents sj1 As Office.CommandBarButton
Attribute sj1.VB_VarHelpID = -1
Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
On Error Resume Next
Set xlapp = Application
=================================在我的的工具工具栏创建试验按钮1==================================
xlapp.CommandBars(tools).Controls(代码缩进).Delete
Set sj1 = xlapp.CommandBars(tools).Controls.Add(Type:=msoControlButton)
With sj1
.Caption = 代码缩进
.Style = msoButtonIconAndCaption
End With
End Sub
Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode _
As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
On Error Resume Next
AddinInstance_Terminate
End Sub
Private Sub AddinInstance_Terminate()
On Error Resume Next
xlapp.CommandBars(tools).Controls(代码缩进).Delete
Set xlapp = Nothing
End Sub
Private Sub sj1_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
IndentCode
End Sub
(二) 把下面代码保存为ModIndentCod
文档评论(0)