0

I have this code

exapplication = new Excel.Application();
Excel.Workbook WB = exapplication.ThisWorkbook;
WB.Connections.AddFromFile("C:\test.odc");

and when I trying to compile it, it gives me the following exception:

Exception from HRESULT: 0x800A03EC
1
  • 3
    Your string literal doesn't escape the backslash character - is this a typo, or could that be your problem? Commented Jan 25, 2011 at 6:37

1 Answer 1

1

You should replace

WB.Connections.AddFromFile("C:\test.odc");

by

WB.Connections.AddFromFile(@"C:\test.odc");

although I don't really think that exception is because of this.

Sign up to request clarification or add additional context in comments.

1 Comment

Or without the literal, escape like this: WB.Connections.AddFromFile("C:\\test.odc");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.