VB工程中源代码导出工具
发布时间:2020-12-17 07:42:40 所属栏目:百科 来源:网络整理
导读:Sub exportVBSourceTool()Dim ExportPath As String,ExtendName As StringDim vbc As VBComponentDim i% 'ExportPath = ThisWorkbook.Path ExportPath = "C:export_VBASource" 'make sure the folder is exist before run For Each vbc In Application.VBE.
Sub exportVBSourceTool() Dim ExportPath As String,ExtendName As String Dim vbc As VBComponent Dim i% 'ExportPath = ThisWorkbook.Path ExportPath = "C:export_VBASource" 'make sure the folder is exist before run For Each vbc In Application.VBE.ActiveVBProject.VBComponents 'get module code line count i = ThisWorkbook.VBProject.VBComponents(vbc.Name).CodeModule.CountOfLines 'if code count>=1,export 'else skip If i >= 1 Then Select Case vbc.Type Case vbext_ct_ClassModule,vbext_ct_Document 'class module,excel object ExtendName = ".Cls" 'set extension name Case vbext_ct_MSForm 'form ExtendName = ".frm" Case vbext_ct_StdModule 'module ExtendName = ".Bas" End Select If ExtendName <> "" Then vbc.Export ExportPath & "" & vbc.Name & ExtendName End If End If Next End Sub依赖库:Microsoft Visual Basic for Application Extensibility 5.3 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |