none
Add multiple textboxes in external exel dynamically RRS feed

Answers

  • Hi,

    Welcome to MSDN forum.

    Since you post the question on VSTO forum, I suppose this is a VSTO project.

    You can use Excel Object Model to add textboxes.

    Here is a sample to add a textbox in Excel worksheet:

    Microsoft.Office.Interop.Excel.Shape shape;
                shape = Globals.ThisAddIn.Application.ActiveSheet.Shapes.AddTextbox
                (Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, 20, 20, 100, 100);
                shape.TextFrame2.TextRange.Text = "VSTO";
    

    If it is not a VSTO project, you can use Excel Object Model to open a specified workbook then add textboxes into a specified worksheet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, January 22, 2014 9:42 AM
    Moderator

All replies

  • Hello kkpatel,

    Where exactly do you want to insert textboxes? Could you please be more specific?

    You can read about possible ways of customizing Excel UI in the Customizing the 2007 Office Fluent Ribbon for Developers article in MSDN.

    Tuesday, January 21, 2014 12:44 PM
  • Hi,

    Welcome to MSDN forum.

    Since you post the question on VSTO forum, I suppose this is a VSTO project.

    You can use Excel Object Model to add textboxes.

    Here is a sample to add a textbox in Excel worksheet:

    Microsoft.Office.Interop.Excel.Shape shape;
                shape = Globals.ThisAddIn.Application.ActiveSheet.Shapes.AddTextbox
                (Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, 20, 20, 100, 100);
                shape.TextFrame2.TextRange.Text = "VSTO";
    

    If it is not a VSTO project, you can use Excel Object Model to open a specified workbook then add textboxes into a specified worksheet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, January 22, 2014 9:42 AM
    Moderator