Read the ActiveCell content in Excel using VSTO

前端 未结 3 1029
青春惊慌失措
青春惊慌失措 2021-01-23 00:01

I\'m trying to read the ActiveCell from within an Excel Add-in but not getting very far. Anyone any ideas?

Excel.Window W = this.Application.ActiveWindow as Exce         


        
相关标签:
3条回答
  • 2021-01-23 00:11

    R.Text.ToString(); will get you the text from the cell

    0 讨论(0)
  • 2021-01-23 00:18

    Is this of any use: http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f21c7cf4-fbfd-4496-a593-781eb751d580

    It suggests turning off proxies for debugging purposes, hinting that the error message you are seeing may be masking a lower level COM error.

    0 讨论(0)
  • 2021-01-23 00:19

    Do not use Activewindow. modified your code as follows Excel.Range R = this.Application.ActiveCell as Excel.Range; if (R != null) MessageBox.Show(R.Value2);

    Note: ActiveCell can be null if user have not chosen a cell in the active sheet.

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