0

I need to link 2 cells from 2 different excel workbooks. How can I do that? Example: Say if A1 cell of Book1 and B2 of Book2 are linked. If I update A1 cell of Book1 with 1000, then B2 of Book2 should automatically get updated to 1000. Any idea how to link the cells in c#?

Thanks in advance.

shriguru nayak
  • 310
  • 1
  • 3
  • 21

1 Answers1

0

I would use the standard way: Build the correct formula in excel, look at the parts and build the string in C#. Then assign this string value to the range.formula property and you are done...

Christian Sauer
  • 10,351
  • 10
  • 53
  • 85
  • I tried that. Its working fine in the worksheet which comes when we run VSTO. But later, if I open any other, it is not working. So, was wandering if there are some c# APIs to do it directly. Are you aware of any? – shriguru nayak Feb 22 '13 at 09:11
  • I am assuming it must be throwing an exception in later case. Can you think of any loophole here? – shriguru nayak Feb 22 '13 at 09:13
  • What happens, if when you set the cell? Do the desired text and the generated text look identical? It would be great if you could provide a sample file and code... – Christian Sauer Feb 22 '13 at 09:31
  • Oh. Resolved it! was getting HRESULT: 0x800A03EC exception. Found out that I was missing THE `'` in the filename! Thanks @christian for your time. – shriguru nayak Feb 22 '13 at 10:00