zoukankan      html  css  js  c++  java
  • AutoCAD VBA 批量导出源代码

    点击查看代码

    Public Sub MyCMD_导出VBA代码()
        Const Module = 1
        Const ClassModule = 2
        Const Form = 3
        Const Document = 100
        Const Padding = 24
        Dim VBComponent As Object
        Dim Count As Integer
        Dim path As String
        Dim directory As String
        Dim extension As String
        Dim fso As New FileSystemObject
        directory = fso.GetParentFolderName(Application.VBE.ActiveVBProject.FileName)
        Count = 0
        If Not fso.FolderExists(directory) Then
            Call fso.CreateFolder(directory)
        End If
        Set fso = Nothing
        For Each VBComponent In Application.VBE.ActiveVBProject.VBComponents
            Select Case VBComponent.Type
            Case ClassModule, Document
                extension = ".cls"
            Case Form
                extension = ".frm"
            Case Module
                extension = ".bas"
            Case Else
                extension = ".txt"
            End Select
            On Error Resume Next
            Err.Clear
            path = directory & "" & VBComponent.Name & extension
            Call VBComponent.Export(path)
            If Err.Number <> 0 Then
                Call MsgBox("Failed to export " & VBComponent.Name & " to " & path, vbCritical)
            Else
                Count = Count + 1
                'Debug.Print "Exported " & Left$(VBComponent.Name & ":" & Space(Padding), Padding) & path
            End If
            On Error GoTo 0
        Next
        MsgBox "Successfully exported " & CStr(Count) & " VBA files to " & directory
    End Sub
  • 相关阅读:
    最简单的jQuery插件
    SQL执行时间
    Resharper 8.2 注册码
    Module模式
    RestSharp使用
    使用MVC过滤器保存操作日志
    Ajax Post 类实例
    IBatis分页显示
    IBatis插入类的实例
    Topcoder SRM629 DIV2 解题报告
  • 原文地址:https://www.cnblogs.com/NanShengBlogs/p/15387368.html
Copyright © 2011-2022 走看看