Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cryptic exception copy/pasting from DataGridView into Excel 2002

Good Morning,

Running Visual Studio 2008 (C# 3.5). DataGridView is loaded manually (not data bound). Copy/pasting into Notepad/Wordpad works fine, but when I try to copy/paste into Excel I get this weird Exception:

Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC))

This was working as of last Friday. I'm completely stumped. I am pretty sure this has worked in the past. I've tried rebooting, re-adding the DataGridView control. Any help much appreciated.

Regards, -Alan.

like image 660
Alan Avatar asked Feb 23 '11 15:02

Alan


1 Answers

Perhaps some of your data is being interpreted by Excel as a formula (like 5/0).

You could try Pat's suggestion first (it's easier!).

Also, try pasting your text into Notepad first, copying everything from Notepad, and pasting that into Excel.

If you still get the errors, try pasting the first half of the text in Notepad. If that succeeds, paste the second half. They key is to try to narrow down which string of text is causing Excel to Barf on you.

like image 102
jp2code Avatar answered Nov 15 '22 04:11

jp2code