Click to See Complete Forum and Search --> : Copy into Excel textbox. Not working. Via C#.net?


KUVU
August 4th, 2007, 02:32 PM
Can any one help me with this in C#.


1) I am trying to copy a string which has length greater than 255 characters in to a ExcelTextBOx.But it not working if i send 255 characters it working fine.
my code is like this
string temp;
Microsoft.Office.Interop.Excel.TextBox txtbox1=(Microsoft.Office.Interop.Excel.TextBox)workbook.TextBoxes("TxtboxName");
txtbox1.text=temp;
txtboxname is the name of the textbox on excel

2)I have one more question string in temp is from a Label on my webpage.It Has some text bolded .How to preserve the format on ExcelTextBox .

3)In the above code textbox1 is the name of the textbox on excel cell[1,1] but i have lot of textboxes on excel i cannot give names by myself,so my question is
How to find out the name of the textbox on a Excel cell from C# using
Microsoft.interop.office.excel libraries.




Please somebody help me with these i am trying for answers since so long.

Thanks
KU

JonnyPoet
August 4th, 2007, 05:28 PM
2)I have one more question string in temp is from a Label on my webpage.It Has some text bolded .How to preserve the format on ExcelTextBox .

As far as I know textboxes are always Text only oterwise they have to be richTextboxes.
Who has created the excel sheet with a lot of textboxes. Why are not simple the cells used for showing text ? Or do you talk about the cells itself naming them textboxes ?

So if there are really textboxes there in excel then use macroeditor to read out their name and how to get access to them. When you get the macrocode post it here for help to transfer it into C#.

Simle switch macro editor to record then add some text into the different Textboxes then look what code you get.

BTW this way you also can try what happens when fillng one textbox withore then 255 signs. If you get in trouble then you know that this is depending on your excel sheet. if not post the code how you transfer the data

KUVU
August 5th, 2007, 10:08 AM
I didn't know exactly what u r telling,i didn't work before on macrocode.Could Please give any sample code link to do this.I am talking about TextBoxes on the Excel not cell because Textbox has more capacity than the cell.

JonnyPoet
August 6th, 2007, 04:43 PM
Sorry I never worked with textboxes in excel before. This things there normally are working with use of VBA So I dont know hoe to access them in C#