VB工程中源代码导出工具
2015-12-11 11:41
525 查看
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
另,执行时可能需要设置宏安全:File -> Options -> Truest Center -> Micro Settings
相关文章推荐
- 今天让VB(非VB.NET)的ListBox给坑了!
- VB6.0“挑衅”.NET!
- 【ITOO】NuGet发布类库包
- 全志H8/a83t专业安卓KTV主板,支持双屏异显,接口丰富,支持vga、hdmi、cvbs显示
- VB 半透明窗体
- 利用VBS脚本删除磁盘中的空文件和空文件夹
- VBA写excel宏
- powerdesigner导出字段信息的vba脚本
- 怎样用VB编写.DLL动态链接库文件
- 怎样用VB编写.DLL动态链接库文件
- 怎样用VB编写.DLL动态链接库文件
- Microsoft VBScript 运行时错误 错误 '800a0005'
- vb.net下打印清单示例(连续纸和固定纸张打印)
- Convert C# to VB.NET
- 关于VB选择打印机,并打印
- VB.NET多线程入门
- 用Visual Basic设计手机短信收发程序
- 用Visual Basic设计手机短信收发程序
- PSI_SI
- vbs版的音乐播放器