Re: Creating an Excel Automation Add-In using C#
From: Peter Huang (v-phuang_at_online.microsoft.com)
Date: 12/06/04
- Previous message: Eric: "Re: interop delegate for COM"
- In reply to: Emmanuel: "Re: Creating an Excel Automation Add-In using C#"
- Next in thread: Emmanuel: "Re: Creating an Excel Automation Add-In using C#"
- Reply: Emmanuel: "Re: Creating an Excel Automation Add-In using C#"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 06 Dec 2004 03:37:00 GMT
Hi
For Q1, I think this may be caused by the different locale, e.g. you set
the locale A in the code, while the excel.exe will get the locale setting
in the system setting which may be different which cause the problem.
For Q2, as we know that the excel is kind of electronical sheet computing
tool which is based on the cell. So if our formula is as below.
=(A1+A2)
once A1 or A2 is changed the formula will be recalculated( if we have turn
on the option of automatically)
While if the formula has nothing to do with the cell change, then the excel
have no idea about the change.
=filevalue()
because the excel will not detect the file has changed, it is also not the
excel's responsibility to do the job.
For now I think we have two options.
1. LoadFile based on a cell value so that whenever the cell is changed ,
the formula will be recalculated.
public double LoadFile(double i)
{
System.Diagnostics.Debug.WriteLine("LoadFile() Called");
StreamReader sr = new StreamReader(@"c:\temp\redist.txt");
string str =sr.ReadToEnd();
sr.Close();
return str.Length;
}
2. Write a Macro as below, which will be called whenever you want to
recalculate the formula,e.g. in the workbook_open ...
Sub Test()
Sheet1.Range("D10").Formula =
"=AutomationAddin.MyFunctionsTest.LoadFile(A1)"
End Sub
Hope this helps.
Best regards,
Perter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
- Previous message: Eric: "Re: interop delegate for COM"
- In reply to: Emmanuel: "Re: Creating an Excel Automation Add-In using C#"
- Next in thread: Emmanuel: "Re: Creating an Excel Automation Add-In using C#"
- Reply: Emmanuel: "Re: Creating an Excel Automation Add-In using C#"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|