473,396 Members | 2,076 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,396 software developers and data experts.

fill a value into a cell in Excel / Office Add-In

Hello,
how do I put a value in a cell in Excel XP
I'm programming an add-in, so all the variables (excelApp ..) work,
I'm just putting the code snipplets here.
click on the Add-in button in the toolbar executes a windows form. in
this form are a textbox and an ok button.
public void showButton_Click (Microsoft.Office.Core.CommandBarButton
barButton, ref bool somebool)
{
object temp1 = new object();
if (this.myAddin.ShowDialog() ==
System.Windows.Forms.DialogResult.OK)
{
temp1 = myAddin.textBox1.Text.ToString();
// note: this works! the value is there!
System.Windows.Forms.MessageBox.Show(temp1.ToStrin g());

// why doesn't this work ? i know temp1 is there (the message
box)
// but the value isn't in the active excel cell.
excelApp.ActiveCell.Value2 = temp1;
}
}

can someone help me ?
cheers
-Peter

}
Nov 15 '05 #1
1 5599
Peter,

Assigning temp1 into a cell really does nothing, as there is no kind of
representation of that object. If anything, you should be assigning
something like a string, or a number into it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Peter Smith" <pe************@yahoo.de> wrote in message
news:5b**************************@posting.google.c om...
Hello,
how do I put a value in a cell in Excel XP
I'm programming an add-in, so all the variables (excelApp ..) work,
I'm just putting the code snipplets here.
click on the Add-in button in the toolbar executes a windows form. in
this form are a textbox and an ok button.
public void showButton_Click (Microsoft.Office.Core.CommandBarButton
barButton, ref bool somebool)
{
object temp1 = new object();
if (this.myAddin.ShowDialog() ==
System.Windows.Forms.DialogResult.OK)
{
temp1 = myAddin.textBox1.Text.ToString();
// note: this works! the value is there!
System.Windows.Forms.MessageBox.Show(temp1.ToStrin g());

// why doesn't this work ? i know temp1 is there (the message
box)
// but the value isn't in the active excel cell.
excelApp.ActiveCell.Value2 = temp1;
}
}

can someone help me ?
cheers
-Peter

}

Nov 15 '05 #2

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

Similar topics

9
by: David Thielen | last post by:
Hi; This concerns Excel's SpreadsheetML format and how Excel writes it. Excel saves an xml file as follows: <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"...
1
by: Steven | last post by:
Hello, I use the following code to make an Excel-file, which works fine with Excel 2003 (and the MS Excel 11.0 object library): Dim Excel As New Excel.Application Dim oBook As...
8
by: John Brock | last post by:
I am creating an Excel workbook using VB.NET, and have run into a problem. Excel at times insists on reformatting data that I enter into cells, e.g., converting "01234" to "1234", and this screws...
0
by: dleh | last post by:
I have been tasked with producing a server application that will convert excel files to html. I have no experience of developing under Windows, (but plenty of UNIX/C++ experience) but I picked...
18
by: Frank M. Walter | last post by:
Hello, I have made an small AddIn with udf for excel 2003. I use vs2003. The point of view is the function __T() I call it in excel sheet writing =__T() I am not able to set a value to a...
1
by: aotemp | last post by:
Hi, Im having a reaaally hard time with something... Im trying to read a cell of data into a String variable. It seems like such a simple task too... Get the excel spreadsheet, get the...
2
by: =?Utf-8?B?RHVrZSBDYXJleQ==?= | last post by:
I *did* have Excel 2003 on my office PC and was fiddling with a little VB Express app that interacted with Excel - nothing complex, but it worked. Since then IT has upgraded me to Office 2007 and...
3
by: spowel4 | last post by:
I need some help with this please: I'm looping through some data to total some figures. Each time the total is calculated I need to insert that total into an excel spreadsheet cell, A2 for...
1
by: Tony Bansten | last post by:
As fas as I heard I can write to Excel cell e.g. E53 from outside with VBS. How could such a code look like? Assume I have an Excel file aaa.xls and a worksheet "ws777" inside: How can I wread...
0
by: nick020483 | last post by:
I've developed a windows application which creates an excel file. The application functions fine on an XP machine running Office 2003. However, it blows out when it's ran on an XP machine running...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.