1

is there a way to compare VBA source code file, like .IVB file from Autodesk Inventor to another one?

Since this kind of file is precompiled, I have to export every modules from both solutions and compare folders.

But I would prefer to compare source code files directly if I can.

Thanks, best regards.

J-SHould
  • 56
  • 6
  • Compare it to what? If you want to load it, maybe something like this http://forums.autodesk.com/t5/inventor-customization/code-to-load-ivb-files/td-p/4314902 – Slai Sep 02 '16 at 13:47
  • To another one. I edited my question. – J-SHould Sep 02 '16 at 15:38

1 Answers1

0

Instead of exporting each file one at a time, you can use this Sub:

Public Sub Export()
    Dim vbe As vbe
    Set vbe = ThisDrawing.Application.vbe
    Dim comp As VBComponent
    Dim outDir As String
    outDir = "c:\\temp\\VBA"
    If Dir(outDir, vbDirectory) = "" Then
        MkDir outDir
    End If
    For Each comp In vbe.ActiveVBProject.VBComponents
        Select Case comp.Type
            Case vbext_ct_StdModule
                comp.Export outDir & "\" & comp.Name & ".bas"
            Case vbext_ct_Document, vbext_ct_ClassModule
                comp.Export outDir & "\" & comp.Name & ".cls"
            Case vbext_ct_MSForm
                comp.Export outDir & "\" & comp.Name & ".frm"
            Case Else
                comp.Export outDir & "\" & comp.Name
        End Select
    Next comp

     MsgBox "VBA files have been exported to: " & outDir
End Sub

You need to add a reference to Microsoft Visual Basic for Applications Extensibility 5.3.

Maxence
  • 12,868
  • 5
  • 57
  • 69