CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2007
    Posts
    3

    Copy into Excel textbox. Not working. Via C#.net?

    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

  2. #2
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Copy into Excel textbox. Not working. Via C#.net?

    Quote Originally Posted by KUVU
    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
    Last edited by JonnyPoet; August 6th, 2007 at 04:12 PM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  3. #3
    Join Date
    Aug 2007
    Posts
    3

    Re: Copy into Excel textbox. Not working. Via C#.net?

    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.

  4. #4
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Copy into Excel textbox. Not working. Via C#.net?

    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#
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured