Help setting formula and values of a cell

D

DanaLe

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 + "\")";
cell.Value2 = printstrings;
}
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(String

memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes,

MessageData& msgData) at
Microsoft.Office.Interop.Excel.Range.set_Formula(Object )



Any ideas on what to do to resolve this? Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top