469,927 Members | 1,832 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Using Excel Interop

Bob
Hey, Ive got a simple question but I cant figure out the
answer. Im not the greatest of programmers.

Im trying to copy stuff over from Word to Excel using
C#. But the problem Im having is when im copying
something such as....

"Hello World

How are you?"

It copies "Hello World" in row one, nothing in row two,
and "How are you?" in row three. And I want to put it
all in one row. I know in Excel to be able to do that,
you have to double click on the cell you want so the
cursor is blinking inide, and copy everything over and
itll be in one cell.

I recorded a Macro in excel to see how you could do that,
but I was never able to stop the recording when I had the
cursor blinking in the cell. It waited for me to type
something or click on another cell for me to able to stop
the recording and the Macro wrote down
ActiveCell.FormulaR1C1 = "whatever i typed". I looked at
the definition of ActiveCell in the Excel INTEROP but
there was no Paste function. FormulaR1C1 using C# was
Value2 but that asked for an object and you cant paste
into that cuz obviously you cant convert a void into an
object.

Its easy enough to Select the cell I want. So I figured
maybe I could tell my program to double click as if I
were using a mouse. and then paste. Ive tried....

System.Windows.Forms.MouseButtons left = new
System.Windows.Forms.MouseButtons[left];

System.Windows.Forms.MouseEventArgs mouse = new
System.Windows.Forms.MouseEventArgs(left, 1, 0, 0, 0);

I dont really know how to use these Mouse Event functions
and was wondering if anyone else did? Or if anyone could
think of a better way for me to copy things over to
excel? I tried converting the phrases into string files
but since strings cant have ENTER spaces, it copied over
a bunch of weird symbols and it didnt look very good.
There has got to be a way to just copy it and then paste
into the cell without converting to a string but I cant
figure it out. Any help?
Nov 15 '05 #1
0 1567

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Chris | last post: by
5 posts views Thread by kewalmehra | last post: by
5 posts views Thread by Mike in Santa Rosa | last post: by
reply views Thread by liam_jones | last post: by
2 posts views Thread by sfeinst | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.