473,383 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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 1697

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris | last post by:
Hi, everything works apart from the last line :-(( rng.Value2.ToString() An exception is thrown : "Old format or invalid type library" It gets compiled though (so he recognizes the property...
5
by: kewalmehra | last post by:
Hi All, I have a requirement of saving Excel files as HTML using C#. I have managed to write code for saving as HTLM file. however this seems to be not working in the once perticular case . ...
5
by: Mike in Santa Rosa | last post by:
I'm trying to get a simple c# app built that can launch/manipulate an excel workbook, sheet. I've chased down several examples and can't any of them to work. So I must be doing somethnig obviouslt...
4
by: B.N.Prabhu | last post by:
How to delete first row from an Excel Sheet using C#.Net. Please Help. Its very urgent.
2
by: Jacob.Bruxer | last post by:
Hi everyone, I'm having trouble opening space delimited textfiles in Excel from Visual Basic.net. I'm able to control, open and modify Excel files from Visual Basic, so my Excel reference seems...
0
by: liam_jones | last post by:
I'm very new to Python, well IronPython to precise, and have been having problems when using Excel. The problem I'm having is the closing of my Excel object. I'm able to successfully quit the...
2
by: sfeinst | last post by:
I am trying to access Excel spreadsheets to modify data from a VB.NET application. If I have an object defined as: Public Class Test Private _excel As Microsoft.Office.Interop.Excel.Application...
0
by: Nicholas Dreyer | last post by:
Operating System: Microsoft Windows Version 5.1 (Build 2600.xpsp_sp2_gdr.050301-1519 : Service Pack 2) Visual Basic: MIcrosoft Visual Basic 6.3 Version 9972 VBA: Retail 6.4.9972 Forms3:...
2
by: Nicholas Dreyer | last post by:
The following error Run-time exception thrown : System.Runtime.InteropServices.COMException - Error loading type library/DLL. happens while running the code listed at the bottom of this...
2
by: Manikandan | last post by:
Hi, I have a program written in .Net Framework 1.1 using Visual studio enterprise edition 2003. I tried compiling the same program in visual c# express edition 2005. I'm getting following...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.