What will work faster VBA module or COM assembly on .NET within the office?

.NET has many interesting pieces that are not in VBA and allow you to write less code than in VBA.

But will it significantly improve performance if you use the COM assembly?

Does the COM build have any limitations? For example, can I transfer the ACCESS RecordSet and somehow process it?

    2 answers 2

    If a com-assembly means interop interaction ... Faster will be direct access to office files (without an intermediary in the form of office aplicus). On the link there will be a little more information on the example with Excel:

    How easy it is to work with / open / edit / save Excel / CSV files

    In short: you need to look for third-party solutions, and not use Interopom because painfully crooked and slow all through it.

    If the question is put only within the framework of "What will be faster to work VBA module or COM assembly on .NET within the office?"

    VBA should work faster. he already has access to the data directly, without intermediaries.

    But in general, BASIC is outdated in principle. He's just plain uncomfortable. This is especially true for VBA. And the VBA IDE is simply unrealistic and it’s not even upgraded and improved for more than 15 years. Therefore personally I would prefer c #.

    For example, can I transfer the ACCESS RecordSet and somehow process it?

    I can not say anything about it.

      What will work faster VBA module or COM assembly on .NET within the office?

      It's all envy of the task. If it is related to the processing of business data divorced from the interface, then .NET definitely wins. If you are interested in performance as part of a reaction to user actions, then VBA is preferable here, because in conjunction with .NET you should always remember about data marshaling.

      .NET has many interesting pieces that are not in VBA and allow you to write less code than in VBA.

      There is no need to be under a delusion, because in addition to the business logic functionality you will have to write the .NET interaction functionality with the Office API. At once I will say that there are no normal interopes from Microsoft.
      The main problem will be connected with the moments of creating and deleting COM objects, i.e. memory leaks, since the loss of a reference to a COM object does not immediately release the memory occupied by this COM object. We'll always have to keep in mind the possibility of using Marshal.FinalReleaseComObject .
      In addition, you will encounter clumsy automatically created function and property names.
      Then the question arose of maintaining functionality for different versions of the Office.

      At some point, it starts to get and think about VBA with the argument that it was made so that it was more convenient to work with the Office API. More likely Office API was sharpened under VBA.

      As an alternative, you will want to look at such side projects with Office as NetOffice .

      Does the COM build have any limitations? For example, can I transfer the ACCESS RecordSet and somehow process it?

      ACCESS - this is probably Microsoft Access?

      COM and .NET is the brainchild of the same Microsoft, so the risks associated with the impossibility of interaction are minimal. So you can safely work from .NET with ADO.