Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Anytime I try to add a textbox to my excel sheet in the following manner an
exception is generated. Excel.Shape textbox; textbox = (Excel.Shape)excelWorksheet.Shapes.AddFormControl( Excel.XlFormControl.xlEditBox, cellx, celly, cellwidth, cellheight); What am I doing wrong? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This worked for me, but it's in VB.. But I believe it shouldn't be too hard
to port to C#. Dim xlApp As New Excel.Application Dim xlWb As Excel.Workbook Dim sht As Excel.Worksheet Dim tb As Excel.OLEObject xlWb = xlApp.Workbooks.Add With xlWb.Sheets("Sheet1") sht = xlWb.Worksheets("Sheet1") tb = sht.OLEObjects.add(ClassType:="Forms.TextBox.1", Link:=False, _ DisplayAsIcon:=False, Left:=120, Top:=48, Width:=132, Height:=53.25) End With xlWb.SaveAs("C:\TEMP\Sample.xls") xlWb.Close(False) xlApp.Quit() -- Hope that helps. Vergel Adriano "SkyKid" wrote: Anytime I try to add a textbox to my excel sheet in the following manner an exception is generated. Excel.Shape textbox; textbox = (Excel.Shape)excelWorksheet.Shapes.AddFormControl( Excel.XlFormControl.xlEditBox, cellx, celly, cellwidth, cellheight); What am I doing wrong? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding shape-type textbox into excel chart sheet | Excel Programming | |||
Textbox changes position on a copied excel-sheet | Excel Discussion (Misc queries) | |||
Display a textbox embedded in the Excel sheet | Excel Programming | |||
Textbox adding problem | Excel Programming | |||
Textbox on excel sheet do not update with VBA | Excel Programming |