is it possible to use C# to write functionality within an excel workbook

前端 未结 2 1391
傲寒
傲寒 2021-01-23 14:32

I have an excel workbook which needs to query data from an HTTP server. Query directly from a remote database isn\'t an option.

From what I know I can use VB macros to c

相关标签:
2条回答
  • 2021-01-23 14:51

    Follow the first couple of repro steps here to create a Visual Studio Tools for Office - Excel Add-In.

    Skip the last step about the calender control.

    In the Excel AddIn Project > add a Ribbon Bar and Button and you can invoke methods to collect the data via http and refresh the workbook. Everything in VSTO is pretty much the exact same way you would do it in VBA but in C# syntax.

    Extend Your VBA Code With VSTO

    When it comes to deploying you should use a Setup Project and it will create an MSI. If you have a App.Config file be aware when deploying you need to set the setup project to add a registry key: https://stackoverflow.com/a/10525693/495455

    I highly recommend this blog for tips on better VSTO memory management via .Net code: http://jake.ginnivan.net/

    0 讨论(0)
  • 2021-01-23 15:05

    You can use the VSTO to create a document or application level addin to Excel. Look here http://msdn.microsoft.com/en-us/office/hh128771.aspx

    0 讨论(0)
提交回复
热议问题