Import Excel Workbook into Visual Studio RRS feed

  • Question

  • Hi,

    Can an Excel document with vba coding and forms imported to Visual Studio.

    I have created an Excel workbook where i have a couple of forms/ modules and sheets interacting with each other, the fields on the forms are importing pictures from files, also reading some data from some of the excel sheets and populating it to another sheet which at the end gets printed out or saved as pdf document. I would like to update the forms so it have a better visual and the whole workbook/ codes/ pictures are acting as one program and can be runned on different PC as well.

    Please let me know if you have a solution.

    Kind regards,



    Thursday, January 2, 2020 4:36 PM

All replies

  • Hi Istvan,

    Welcome to MSDN forum.

    According to your description, I think your issue is more related to VBA, and I will move this thread to VBA forum and you could get more professional help there.

    BTW, this similar issue: Is it possible to write Excel VBA Code in Visual Studio may be helpful for you to refer to.

    Sorry for this inconvenience and thanks for your understanding.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 3, 2020 5:46 AM
  • I'm not sure of your objective.  You can't run VBA code from VS.  VBA code is embedded in the workbook.  If you add a .zip after the .xlsm and unzip the file you can find the VBA files.  Perhaps if you stated your objective we could provide a better response.
    Friday, January 3, 2020 3:30 PM
  • My main question would be..can I transform my excel workbook with all the vba content to a Visual studio Project.


    Saturday, January 4, 2020 10:29 AM
  • You can't create a VS project from a VBA project. 

    There is something called Visual Studio Tools for Office (VSTO).  VSTO uses an Interop to communicate to Excel/Word.  So you can write the GUI in Windows Forms or XPF(XAML). Most Excel VBA commands have an equivalent in VSTO.  I did an experiment in VSTO.  I had an Excel VBA addin that performed an optimization of memory configurations for a microchip.  It took 1 hour to run in VBA and 8 hours in VSTO.  The Excel Interop is very inefficient.  You need Excel installed on the computer to use VSTO. 

    There is a tool called EPPlus that can create Excel workbooks including VBA.  I'm not sure about Forms.  It doesn't have the capability I needed for Pivot Tables so I don't use it.  You can't execute the workbook.  You don't need Excel installed.  It has a .NET core release so you can run it on Linux.
    Saturday, January 4, 2020 3:06 PM
  • I would like to see Office (at least Excel/Word) directly support .NET.  You could automate Excel/Word with .NET and not use Interop.  You'd use VS to create project.  I just don't see this happening.  It would require rewriting Excel/Word.  I would like to see MS offer a license where Excel/Word could run on a Web Server.
    Saturday, January 4, 2020 3:30 PM