NetOfficeFw / NetOffice

🌌 Create add-ins and automation code for Microsoft Office applications.
MIT License
697 stars 143 forks source link

Application.Range is not working #250

Closed mahadevappakanike closed 4 years ago

mahadevappakanike commented 5 years ago

Dear Community, Application.Range is not returning a range object when i pass the valid range name parameter. This code used to work fine for some years but now it is broken all of a sudden. I think Application.Range is searching in active workbook alone whereas earlier it used to search in all workbooks. Context:

I am performing a cut/paste custom functionality using ribbon button press( but not Ctrl+X & ctrl+V). Here when I Cut View(range name) from one workbook(e.g. Workbook1) to another workbook(e.g. workbook2), then Application.Ramge is not finding the range object of Workbook1 using named range. It is returning null. I would like to delete the Cut view object in workbook1 after pasting the range in workbook2.

This functionality used to work well earlier but not it is stopped.

Kindly suggest a possible solution for my use case. Regards, Mahadev

mahadevappakanike commented 5 years ago

For now, I have a temporary fix which is working. Solution: Since Application.Range works for active Workgroup, i have activated the workbook1 and did search for named range and did whataver stuff i wanted to do and activate back to workbook2.

jozefizso commented 5 years ago

This is an issue/feature in the MS Excel API, not the NetOffice implementation.