Help setting formula and values of a cell
Hi all, I'm attempting to automate production of an excel worksheet with a
displayed text value, and a hyperlinked address. I'm using the following code:
for (int i = 0; i < printstrings.Length; i++)
{
Excel.Range cell =
(Excel.Range)currentworksheet.Cells[currentlinenumber, i + 1];
cell.Formula = "=HYPERLINK(\"" + hyperlinks[i] + "\")";
cell.Value2 = printstrings[i];
}
currentlinenumber++;
This executes successfully in debug mode on my development machine, but when
I test the application on other machines, I get the error:
System.Runtime.InteropServices.COMException (0x800A03EC):
Exception from HRESULT: 0x800A03EC at
System.RuntimeType.ForwardCallToInvokeMember(Strin g
memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes,
MessageData& msgData) at
Microsoft.Office.Interop.Excel.Range.set_Formula(O bject )
Any ideas on what to do to resolve this? Thanks in advance!
|