Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 829171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:50:24+00:00 2026-05-15T03:50:24+00:00

This is all in C# .NET Excel Interop Automation for Office 2007. Say you

  • 0

This is all in C# .NET Excel Interop Automation for Office 2007.

Say you create two excel apps and open the same workbook for each application:

app = new Excel.ApplicationClass();
app2 = new Excel.ApplicationClass();

string fileLocation = "myBook.xslx";

workbook = app.Workbooks.Open(fileLocation,
            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
             Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
            Type.Missing, Type.Missing, Type.Missing, Type.Missing);

workbook2 = app2.Workbooks.Open(fileLocation,
            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
             Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
            Type.Missing, Type.Missing, Type.Missing, Type.Missing);

Now, I want to replicate any changes that occur in workbook2, into workbook. I figured out I can hook up the SheetChanged event to capture cell changes:

app.SheetChange += new Microsoft.Office.Interop.Excel.AppEvents_SheetChangeEventHandler(app_SheetChange);

void app_SheetChange(object Sh, Microsoft.Office.Interop.Excel.Range Target)
{
     Excel.Worksheet sheetReadOnly = (Excel.Worksheet)Sh;

     string changedRange = Target.get_Address(missing, missing,
                Excel.XlReferenceStyle.xlA1, missing, missing);

     Console.WriteLine("The value of " + sheetReadOnly.Name + ":" +
                changedRange + " was changed to = " + Target.Value2);

     Excel.Worksheet sheet = workbook.Worksheets[sheetReadOnly.Index] as Excel.Worksheet;

     Excel.Range range = sheet.get_Range(changedRange, missing);

     range.Value2 = Target.Value2;
 }

How do you capture calculate changes? I can hook onto the calculate event but the only thing that is passed is the sheet, not the cells that were updated. I tried forcing an app.Calculate() or app.CalculateFullRebuild() but nothing updates in the other application. The change event does not get fired when formulas change (i.e. a slider control causes a SheetCalculate event and not a SheetChange event)

Is there a way to see what formulas were updated? Or is there an easier way to sync two workbooks programmatically in real time?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:50:25+00:00Added an answer on May 15, 2026 at 3:50 am

    I don’t think there is any direct event which will tell you which cells are being calculated, as the events propogation is defaulted to false otherwise the calculate function will end into an infinite loop.
    Also note the sheet change triggers the automatic calculate. And calculate happens on the whole sheet not just the changes, to make sure there is any modification in the formula addresses. Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All of these questions: Excel 2007 Hangs When Closing via .NET How to properly
Issue: I am using the Microsoft.Office.Interop.Excel library in an ASP.NET application, and I have
I have the following in a program (written in VB.NET): Imports Microsoft.Office.Interop.Excel Public Class
Does anyone know how to get the MS Office 2007 .NET C# Interop libraries
I'm a newbie to all this ASP.NET MVC stuff, and I was making some
Does .net have the equivilent of Delphi's QuotedStr function. This replaces all quotes with
<?php $a="php.net s earch for in the all php.net sites this mirror only function
I developed a win forms app targeting .net 2.0. All of this is in
All my questions in this topic related to asp.net 2.0 While working on some
Now this is .NET but I am sure the principal should apply to all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.