要用vba将vba工程中的所有模块导出,需要用到CodeModule对象的Export方法,代码如下:
Sub QQ1722187970() Dim oVC As VBComponent Dim sPath As String sPath = Excel.ThisWorkbook.Path For Each oVC In Excel.ThisWorkbook.VBProject.VBComponents With oVC sName = .Name '导出 .Export sPath & "\" & sName End With Next End Sub
发表评论