none
How to retrieve macro name list without Interop methodology in C#? RRS feed

  • Question

  • Hi,

       I have created winform application - to retrieve active excel application details fro desktop. Currently i am using Microsoft.Office.Interop.Excel to get all excel file properties.

       I am looking for methodology to retrieve all excel file properties without using Interop.

        I have analyzed through so many blogs and I have tried through "Late binding" approach to get excel file properties.In this approach I am unable to get following values "Macro Names","Macro properties","Built-in properties" .

        Kindly guide me , If any approach which helps me to get all excel file properties.

    Thanks,

    Meenakshi K

     

    Monday, June 8, 2015 3:08 PM

Answers

  • Hi Meenakshi,

    >> using interop object my application memory is getting increased, event though i am releasing object in finally{}. Hence to avoid memory issue i am looking for any other approach to get all excel file properties.

    In my option, using InvokeMember() method is Excel automation. To get details information from excel file, I am afraid that there is no better without Interop.

    As far as I know, after you release manage object, the memory do not release immediately. It will wait for GC to release. It seems that you need an efficient method to get all excel file details, am I right? As my experience, there is no obvious when I use Interop to operate with Excel. Did you get obvious performance issue? If you did, I think we need to find the bottle-neck of the performance issue, and then find the root cause. It would be much helpful if you could share us which operation or code make your memory increase much larger.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, June 12, 2015 10:08 AM

All replies

  • ​Hi Meenakshi,

    First of all, I am a little confused about why you do not want to use Interop. Did it have any limitation to you?

    >> I am looking for methodology to retrieve all excel file properties without using Interop.

    As far as I know, there are two ways to operate Excel, excel automation (with Interop) and OpenXml. With OpenXMl, you could not get the Macro Names, so, if you do not want to use Interop, I am afraid that there is no way to achieve your requirement.

    >> I have analyzed through so many blogs and I have tried through "Late binding" approach to get excel file properties.In this approach I am unable to get following values "Macro Names","Macro properties","Built-in properties" .

    What do you mean by "Late binding" approach? Did you mean the early binding and late binding in automation as the link below? As this article, the term Automation object can be applied to virtually any COM object, even those that do not support IDispatch (and therefore cannot be late bound).
    #Using early binding and late binding in Automation
    https://support.microsoft.com/en-us/kb/245115

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, June 9, 2015 12:00 PM
  • Hi Edward,

    >>First of all, I am a little confused about why you do not want to use Interop. Did it have any limitation to you?

    Using Interop I am able to get all excel file details (Like workbook name,sheet name,macro name, macro line of code,module value,built-in property).But using interop object my application memory is getting increased, event though i am releasing object in finally{}. Hence to avoid memory issue i am looking for any other approach to get all excel file properties.

    >>"Late binding" approach

     I mean the "Late Binding" approach is using InvokeMember() method i can retrieve COM object of excel and binding value using COM interface.

    Thanks,

    Meenakshi

    Wednesday, June 10, 2015 6:39 AM
  • Hi Meenakshi,

    >> using interop object my application memory is getting increased, event though i am releasing object in finally{}. Hence to avoid memory issue i am looking for any other approach to get all excel file properties.

    In my option, using InvokeMember() method is Excel automation. To get details information from excel file, I am afraid that there is no better without Interop.

    As far as I know, after you release manage object, the memory do not release immediately. It will wait for GC to release. It seems that you need an efficient method to get all excel file details, am I right? As my experience, there is no obvious when I use Interop to operate with Excel. Did you get obvious performance issue? If you did, I think we need to find the bottle-neck of the performance issue, and then find the root cause. It would be much helpful if you could share us which operation or code make your memory increase much larger.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, June 12, 2015 10:08 AM