0

I am trying to run a macro with c# in OfficeWriter.
I have tried below but does not work.
Has anyone done this before?

ExcelApplication xla = new ExcelApplication();
xla.RUN("Macro1");

SoftArtisans.OfficeWriter.ExcelWriter;
Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
  • First *"does not work"* is pretty useless as an error description. Second I doubt that anything else than Excel itself can run a VBA code in Excel files. Implementing manipulation of Excel files with a 3rd party tool like OfficeWriter is one thing but implementing entire fully compatible VBA support is another. So I doubt that VBA is supported. Please check the documentation of OfficeWriter. – Pᴇʜ Feb 23 '21 at 07:34
  • There would be 2 workarounds: First is to open the file in Excel to run the VBA code there. Second is to implement whatever the VBA code does using OfficeWriter in C#. – Pᴇʜ Feb 23 '21 at 07:36
  • Officewriter is using a excel template which has the macro in it. So with officewriter we open the template import data then I want to be able to run the macro. – Bernie Steiert Feb 23 '21 at 22:12
  • I understood what you *want* but I doubt that it is possible with OfficeWriter. You wanting it doesn't make it happen, it needs to be possible at first. Check the documentation of OfficeWriter if it supports running VBA code or not, or raise a support ticket at OfficeWriter. I haven't seen anything in the documentation that says running VBA code is possible, so I assume this is not supported. – Pᴇʜ Feb 24 '21 at 07:36
  • Good onya mate, thanks for your help. – Bernie Steiert Feb 25 '21 at 10:47

0 Answers0