Click here to Skip to main content
15,906,645 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am processing an excel file using C#.

I am using excel concatenate formula that includes comma and single quotes.
But everytime it throws the error - Exception from HRESULT: 0x800A03EC.

This is the formula:
Sht1.Range["U2"].Formula = "=CONCATENATE(A2,\",\",\"TO_DATE(\",B2,\",'dd-mm-yyyy')\",\",\",C2,\",\",D2,\",\",E2,\",\"F2,\",\",G2,\",\",)";


Funny that when I use the concatenate function without so much complicacy, it works, like:

Sht1.Range["U2"].Formula = "=CONCATENATE(A2,B2,C2,D2,E2,F2,G2)";

The output requires comma and single quotes.

I think the syntax in first formula is not right. But I am not able to find it out. Is there any other way to write such a formula?

Any help?

What I have tried:

Simple formula works but when comma and backslash are used, it gives error.
Posted
Updated 5-Oct-17 23:30pm
Comments
Patrice T 6-Oct-17 19:28pm    
Show the resulting formula you want to have in excel U2 cell.

1 solution

I think you can simply write it as below -

Sht1.Range["U2"].Formula ="=CONCATENATE(A2," + "TEST" ",B2,C2)"
 
Share this answer
 
Comments
planetz 10-Oct-17 0:43am    
Well I found out that I have typed the formula wrong which gave the error. My mistake!!
Thank you though..!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900