//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet ws = workbook.Worksheets["Sheet1"]; #region Fill data var rngB1 = "Document Solutions for Excel Product Feedback - Form Controls"; ws.Range["$B$1"].Value = rngB1; var rngB3I3 = new object[,] { { "Please take a moment to let us know your feedback about Form Controls in Document Solutions for Excel. Your feedback is valuable and will help us to improve our product and better serve our customers.", null, null, null, null, null, null, null} }; ws.Range["$B$3:$I$3"].Value = rngB3I3; var rngB5 = "1. How difficult is it to use the Form Controls in Document Solutions for Excel?"; ws.Range["$B$5"].Value = rngB5; var rngD7I7 = new object[,] { { "Very difficult", "Difficult", "Neutral", "Easy", "Very easy", "I've never tried to use the feature because I don't know how."} }; ws.Range["$D$7:$I$7"].Value = rngD7I7; var rngB8B13 = new object[,] { { "Create and initialize controls"}, { "Access controls in a worksheet"}, { "Read/write properties"}, { "Copy/cut controls"}, { "Range based data binding"}, { "Port existing code that uses Excel Form Controls"} }; ws.Range["$B$8:$B$13"].Value = rngB8B13; var rngB15 = "2. What new features would you like to see in the Form Controls in Document Solutions for Excel?"; ws.Range["$B$15"].Value = rngB15; var rngB21 = "3. Please rank the following in order of importance"; ws.Range["$B$21"].Value = rngB21; var rngB23C25 = new object[,] { { 1d, "Compatibility of files exported by Microsoft Excel"}, { 2d, "New features"}, { 3d, "Performance"} }; ws.Range["$B$23:$C$25"].Value = rngB23C25; var rngB27 = "4. Which programming language are you primarily using to access Form Controls with Document Solutions for Excel?"; ws.Range["$B$27"].Value = rngB27; var rngI28I30 = new object[,] { { ".NET languages (C#, VB.NET, F#, C++/CLI,...)"}, { "JVM languages (Java, Kotlin,...)"}, { "Scripting languages (PowerShell, Python,...)"} }; ws.Range["$I$28:$I$30"].Value = rngI28I30; var rngE29 = "Other:"; ws.Range["$E$29"].Value = rngE29; var rngB31 = "5. Would you like to suggest this feature to your colleagues?"; ws.Range["$B$31"].Value = rngB31; var rngA33B33 = new object[,] { { 5d, "Very unlikely"} }; ws.Range["$A$33:$B$33"].Value = rngA33B33; var rngI33 = "Very likely"; ws.Range["$I$33"].Value = rngI33; var rngB37I37 = new object[,] { { "6. Thank you for taking our survey. Your feedback is important and will help us create a better product for you and other developers.", null, null, null, null, null, null, null} }; ws.Range["$B$37:$I$37"].Value = rngB37I37; var rngB39 = "Name"; ws.Range["$B$39"].Value = rngB39; var rngB41 = "Email"; ws.Range["$B$41"].Value = rngB41; var style1 = ws.Range["$A$8:$A$13,$A$29,$E$32,$A$33"]; style1.NumberFormat = ";;;"; var style2 = ws.Range["$B$23:$B$25"]; style2.NumberFormat = "\"P\"0"; var style3 = ws.Range["$B$1:$I$1"].Font; style3.ThemeColor = ThemeColor.Dark2; style3.Bold = true; style3.Size = 15d; var style4 = ws.Range["$B$5:$I$5,$B$15:$I$15,$B$21:$I$21,$B$27:$I$27,$B$31:$I$31,$B$37:$I$37"].Font; style4.ThemeColor = ThemeColor.Dark2; style4.Bold = true; style4.Size = 13d; var style5 = ws.Range["$I$28:$I$30"].Font; style5.ThemeColor = ThemeColor.Light1; var style6 = ws.Range["$B$1:$I$1"].Borders; style6[BordersIndex.EdgeBottom].ThemeColor = ThemeColor.Accent1; style6[BordersIndex.EdgeBottom].LineStyle = BorderLineStyle.Thick; var style7 = ws.Range["$B$5:$I$5,$B$15:$I$15,$B$21:$I$21,$B$27:$I$27,$B$31:$I$31,$B$37:$I$37"].Borders; style7[BordersIndex.EdgeBottom].ThemeColor = ThemeColor.Accent1; style7[BordersIndex.EdgeBottom].LineStyle = BorderLineStyle.Thick; var style8 = ws.Range["$C$39,$C$41"].Borders; style8[BordersIndex.EdgeBottom].ThemeColor = ThemeColor.Light2; style8[BordersIndex.EdgeBottom].LineStyle = BorderLineStyle.Medium; style8[BordersIndex.EdgeLeft].ThemeColor = ThemeColor.Light2; style8[BordersIndex.EdgeLeft].LineStyle = BorderLineStyle.Medium; style8[BordersIndex.EdgeRight].ThemeColor = ThemeColor.Light2; style8[BordersIndex.EdgeRight].LineStyle = BorderLineStyle.Medium; style8[BordersIndex.EdgeTop].ThemeColor = ThemeColor.Light2; style8[BordersIndex.EdgeTop].LineStyle = BorderLineStyle.Medium; var style9 = ws.Range["$E$19,$F$29"].Borders; style9[BordersIndex.EdgeBottom].ThemeColor = ThemeColor.Light2; style9[BordersIndex.EdgeBottom].LineStyle = BorderLineStyle.Medium; style9[BordersIndex.EdgeLeft].ThemeColor = ThemeColor.Light2; style9[BordersIndex.EdgeLeft].LineStyle = BorderLineStyle.Medium; style9[BordersIndex.EdgeTop].ThemeColor = ThemeColor.Light2; style9[BordersIndex.EdgeTop].LineStyle = BorderLineStyle.Medium; var style10 = ws.Range["$F$19,$G$29"].Borders; style10[BordersIndex.EdgeBottom].ThemeColor = ThemeColor.Light2; style10[BordersIndex.EdgeBottom].LineStyle = BorderLineStyle.Medium; style10[BordersIndex.EdgeTop].ThemeColor = ThemeColor.Light2; style10[BordersIndex.EdgeTop].LineStyle = BorderLineStyle.Medium; var style11 = ws.Range["$G$19,$H$29"].Borders; style11[BordersIndex.EdgeBottom].ThemeColor = ThemeColor.Light2; style11[BordersIndex.EdgeBottom].LineStyle = BorderLineStyle.Medium; style11[BordersIndex.EdgeRight].ThemeColor = ThemeColor.Light2; style11[BordersIndex.EdgeRight].LineStyle = BorderLineStyle.Medium; style11[BordersIndex.EdgeTop].ThemeColor = ThemeColor.Light2; style11[BordersIndex.EdgeTop].LineStyle = BorderLineStyle.Medium; var style12 = ws.Range["$B$3:$I$3"]; style12.HorizontalAlignment = HorizontalAlignment.Left; style12.VerticalAlignment = VerticalAlignment.Center; style12.WrapText = true; style12.AddIndent = false; var style13 = ws.Range["$B$8,$C$23:$C$25,$E$29"]; style13.VerticalAlignment = VerticalAlignment.Center; style13.AddIndent = false; var style14 = ws.Range["$B$9:$B$13,$B$23:$B$25"]; style14.HorizontalAlignment = HorizontalAlignment.Left; style14.VerticalAlignment = VerticalAlignment.Center; style14.AddIndent = false; var style15 = ws.Range["$B$37:$I$37"]; style15.HorizontalAlignment = HorizontalAlignment.Left; style15.WrapText = true; style15.AddIndent = false; var style16 = ws.Range["$D$7:$H$7,$E$19:$G$19,$F$29:$H$29"]; style16.HorizontalAlignment = HorizontalAlignment.Center; style16.AddIndent = false; var style17 = ws.Range["$I$7"]; style17.WrapText = true; style17.AddIndent = false; ws.Range["$B$3:$I$3"].Merge(); ws.Range["$E$19:$G$19"].Merge(); ws.Range["$B$37:$I$37"].Merge(); ws.Range["$F$29:$H$29"].Merge(); ws.Range["$1:$1"].RowHeight = 20.4d; ws.Range["$3:$3"].RowHeight = 32.4d; ws.Range["$5:$5,$15:$15,$27:$27,$31:$31"].RowHeight = 18d; ws.Range["$7:$7"].RowHeight = 57.6d; ws.Range["$8:$9,$11:$13"].RowHeight = 24d; ws.Range["$10:$10"].RowHeight = 25.2d; ws.Range["$17:$21,$39:$39"].RowHeight = 18.6d; ws.Range["$23:$25"].RowHeight = 24.6d; ws.Range["$28:$28,$38:$38"].RowHeight = 15.6d; ws.Range["$29:$29"].RowHeight = 27d; ws.Range["$37:$37"].RowHeight = 37.8d; ws.Range["$40:$40"].RowHeight = 10.2d; ws.Range["$41:$41"].RowHeight = 19.8d; ws.Range["$A:$A"].ColumnWidthInPixel = 36d; ws.Range["$B:$B"].ColumnWidthInPixel = 57d; ws.Range["$C:$C"].ColumnWidthInPixel = 260d; ws.Range["$D:$D"].ColumnWidthInPixel = 107d; ws.Range["$I:$I"].ColumnWidthInPixel = 139d; ws.Range["$J:$J"].ColumnWidthInPixel = 48d; #endregion // Group: Create and initialize controls ws.Controls.AddGroupBox(266.55, 175.8, 370, 20.4). Text = string.Empty; ws.Controls.AddOptionButton(299.95, 178.2, 26.4, 16.19). Text = string.Empty; ws.Controls.AddOptionButton(361.8, 178.2, 26.39, 16.19). Text = string.Empty; ws.Controls.AddOptionButton(407.8, 178.2, 26.39, 16.19). Text = string.Empty; ws.Controls.AddOptionButton(455.2, 177.6, 26.4, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(507.4, 178.2, 23.39, 16.19). Text = string.Empty; var optA8 = ws.Controls.AddOptionButton(580, 177.6, 26.39, 16.2); optA8.LinkedCell = ws.Range["$A$8"]; optA8.Text = string.Empty; // Group: Access controls in a worksheet ws.Controls.AddGroupBox(266.55, 199.8, 370, 20.4). Text = string.Empty; ws.Controls.AddOptionButton(299.95, 202.2, 26.39, 16.19). Text = string.Empty; ws.Controls.AddOptionButton(361.8, 202.2, 26.39, 16.19). Text = string.Empty; ws.Controls.AddOptionButton(407.8, 202.2, 26.39, 16.19). Text = string.Empty; ws.Controls.AddOptionButton(455.2, 201.6, 26.39, 16.19). Text = string.Empty; ws.Controls.AddOptionButton(507.4, 202.2, 23.39, 16.19). Text = string.Empty; var optA9 = ws.Controls.AddOptionButton(580, 201.6, 26.39, 16.19); optA9.LinkedCell = ws.Range["$A$9"]; optA9.Text = string.Empty; // Group: Read/write properties ws.Controls.AddGroupBox(266.55, 223.8, 370, 20.4). Text = string.Empty; ws.Controls.AddOptionButton(299.95, 226.2, 26.39, 16.19). Text = string.Empty; ws.Controls.AddOptionButton(361.8, 226.2, 26.39, 16.19). Text = string.Empty; ws.Controls.AddOptionButton(407.8, 226.2, 26.39, 16.19). Text = string.Empty; ws.Controls.AddOptionButton(455.2, 225.6, 26.39, 16.19). Text = string.Empty; ws.Controls.AddOptionButton(507.4, 226.2, 23.39, 16.19). Text = string.Empty; var optA10 = ws.Controls.AddOptionButton(580, 225.6, 26.39, 16.19); optA10.LinkedCell = ws.Range["$A$10"]; optA10.Text = string.Empty; // Group: Copy/cut controls ws.Controls.AddGroupBox(266.55, 249, 370, 20.39). Text = string.Empty; ws.Controls.AddOptionButton(299.95, 251.4, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(361.8, 251.4, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(407.8, 251.4, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(455.2, 250.79, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(507.4, 251.4, 23.39, 16.2). Text = string.Empty; var optA11 = ws.Controls.AddOptionButton(580, 250.79, 26.39, 16.2); optA11.LinkedCell = ws.Range["$A$11"]; optA11.Text = string.Empty; // Group: Range based data binding ws.Controls.AddGroupBox(266.55, 273, 370, 20.4). Text = string.Empty; ws.Controls.AddOptionButton(299.95, 275.4, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(361.8, 275.4, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(407.8, 275.4, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(455.2, 274.8, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(507.4, 275.4, 23.39, 16.2). Text = string.Empty; var optA12 = ws.Controls.AddOptionButton(580, 274.8, 26.39, 16.2); optA12.LinkedCell = ws.Range["$A$12"]; optA12.Text = string.Empty; // Group: Port existing code that uses Excel Form Controls ws.Controls.AddGroupBox(266.55, 297, 370, 20.4). Text = string.Empty; ws.Controls.AddOptionButton(299.95, 299.4, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(361.8, 299.4, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(407.8, 299.4, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(455.2, 298.8, 26.39, 16.2). Text = string.Empty; ws.Controls.AddOptionButton(507.4, 299.4, 23.39, 16.2). Text = string.Empty; var optA13 = ws.Controls.AddOptionButton(580, 298.8, 26.39, 16.2); optA13.LinkedCell = ws.Range["$A$13"]; optA13.Text = string.Empty; var ctl29 = ws.Controls.AddCheckBox(28.8, 367.20, 66.75, 16.79); ctl29.Text = "Rich text"; var ctl30 = ws.Controls.AddCheckBox(29.4, 385.80, 151.35, 16.79); ctl30.Text = "Styles, such as color and lines"; var ctl31 = ws.Controls.AddCheckBox(29.4, 405.00, 151.35, 16.80); ctl31.Text = "Scale"; var ctl32 = ws.Controls.AddCheckBox(174.15, 367.8, 175.04, 16.80); ctl32.Text = "Alternative text"; var ctl33 = ws.Controls.AddCheckBox(174.15, 385.20, 175.04, 16.80); ctl33.Text = "Grouping"; var ctl34 = ws.Controls.AddCheckBox(174.15, 404.40, 175.04, 16.79); ctl34.Text = "Attach to macros"; var ctl35 = ws.Controls.AddCheckBox(345.6, 367.8, 165, 16.80); ctl35.Text = "Use formula in buttons"; var ctl36 = ws.Controls.AddCheckBox(345.6, 385.80, 165, 16.79); ctl36.Text = "Other (please specify)"; var ctl37 = ws.Controls.AddSpinner(45.6, 476.40, 17.4, 21); ctl37.Max = 3; ctl37.Min = 1; ctl37.SmallChange = 1; ctl37.LinkedCell = ws.Range["$B$23"]; ctl37.Value = 1; var ctl38 = ws.Controls.AddSpinner(45.6, 501.00, 17.4, 20.99); ctl38.Max = 3; ctl38.Min = 1; ctl38.SmallChange = 1; ctl38.LinkedCell = ws.Range["$B$24"]; ctl38.Value = 2; var ctl39 = ws.Controls.AddSpinner(45.6, 525.60, 17.4, 21); ctl39.Max = 3; ctl39.Min = 1; ctl39.SmallChange = 1; ctl39.LinkedCell = ws.Range["$B$25"]; ctl39.Value = 3; var ctl54 = ws.Controls.AddDropDown(30, 599.40, 213.15, 20.39); ctl54.DropDownLines = 3; ctl54.ItemsSourceRange = ws.Range["$I$28:$I$30"]; ctl54.SelectedIndex = -1; ctl54.LinkedCell = ws.Range["$A$29"]; ctl54.Value = 0; var ctl55 = ws.Controls.AddScrollBar(31.2, 690.60, 576, 24.60); ctl55.LargeChange = 1; ctl55.Orientation = FormControlOrientation.Horizontal; ctl55.Max = 10; ctl55.Min = 0; ctl55.SmallChange = 1; ctl55.LinkedCell = ws.Range["$A$33"]; ctl55.Value = 8; var ctl56 = ws.Controls.AddButton(265.35, 851.40, 127.04, 45); ctl56.HorizontalTextAlignment = HorizontalAlignment.Center; ctl56.Orientation = TickLabelOrientation.OrientationHorizontal; ctl56.VerticalTextAlignment = VerticalAlignment.Center; ctl56.DefaultButton = true; ctl56.Text = "Submit"; var ctl57 = ws.Controls.AddLabel(292.35, 671.40, 60.60, 18.00); ctl57.Text = "I'm not sure"; var ctl58 = ws.Controls.AddLabel(433.8, 672.60, 66.59, 18.60); ctl58.Text = "Likely"; var ctl59 = ws.Controls.AddLabel(143.55, 672.00, 60.59, 18.60); ctl59.Text = "Unlikely"; // Save to an excel file workbook.Save("FeedbackForm.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim ws As IWorksheet = workbook.Worksheets("Sheet1") #Region "Fill data" Dim rngB1 = "Document Solutions for Excel Product Feedback - Form controls" ws.Range("$B$1").Value = rngB1 Dim rngB3I3 = New Object(,) { {"Please take a moment to let us know your feedback about Form controls in Document Solutions for Excel. Your feedback is valuable and will help us to improve our product and better serve our customers.", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing} } ws.Range("$B$3:$I$3").Value = rngB3I3 Dim rngB5 = "1. How difficult is it to use the form controls in Document Solutions for Excel?" ws.Range("$B$5").Value = rngB5 Dim rngD7I7 = New Object(,) { {"Very difficult", "Difficult", "Neutral", "Easy", "Very easy", "I've never tried to use the feature because I don't know how."} } ws.Range("$D$7:$I$7").Value = rngD7I7 Dim rngB8B13 = New Object(,) { {"Create and initialize controls"}, {"Access controls in a worksheet"}, {"Read/write properties"}, {"Copy/cut controls"}, {"Range based data binding"}, {"Port existing code that uses Excel form controls"} } ws.Range("$B$8:$B$13").Value = rngB8B13 Dim rngB15 = "2. What new features would you like to see in the form controls in Document Solutions for Excel?" ws.Range("$B$15").Value = rngB15 Dim rngB21 = "3. Please rank the following in order of importance" ws.Range("$B$21").Value = rngB21 Dim rngB23C25 = New Object(,) { {1.0R, "Compatibility of files exported by Microsoft Excel"}, {2.0R, "New features"}, {3.0R, "Performance"} } ws.Range("$B$23:$C$25").Value = rngB23C25 Dim rngB27 = "4. Which programming language are you primarily using to access form controls with Document Solutions for Excel?" ws.Range("$B$27").Value = rngB27 Dim rngI28I30 = New Object(,) { {".NET languages (C#, VB.NET, F#, C++/CLI,...)"}, {"JVM languages (Java, Kotlin,...)"}, {"Scripting languages (PowerShell, Python,...)"} } ws.Range("$I$28:$I$30").Value = rngI28I30 Dim rngE29 = "Other:" ws.Range("$E$29").Value = rngE29 Dim rngB31 = "5. Would you like to suggest this feature to your colleagues?" ws.Range("$B$31").Value = rngB31 Dim rngA33B33 = New Object(,) { {5.0R, "Very unlikely"} } ws.Range("$A$33:$B$33").Value = rngA33B33 Dim rngI33 = "Very likely" ws.Range("$I$33").Value = rngI33 Dim rngB37I37 = New Object(,) { {"6. Thank you for taking our survey. Your feedback is important and will help us create a better product for you and other developers.", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing} } ws.Range("$B$37:$I$37").Value = rngB37I37 Dim rngB39 = "Name" ws.Range("$B$39").Value = rngB39 Dim rngB41 = "Email" ws.Range("$B$41").Value = rngB41 Dim style1 = ws.Range("$A$8:$A$13,$A$29,$E$32,$A$33") style1.NumberFormat = ";;;" Dim style2 = ws.Range("$B$23:$B$25") style2.NumberFormat = """P""0" With ws.Range("$B$1:$I$1").Font .ThemeColor = ThemeColor.Dark2 .Bold = True .Size = 15.0R End With With ws.Range("$B$5:$I$5,$B$15:$I$15,$B$21:$I$21,$B$27:$I$27,$B$31:$I$31,$B$37:$I$37").Font .ThemeColor = ThemeColor.Dark2 .Bold = True .Size = 13.0R End With Dim style5 = ws.Range("$I$28:$I$30").Font style5.ThemeColor = ThemeColor.Light1 Dim style6 = ws.Range("$B$1:$I$1").Borders style6(BordersIndex.EdgeBottom).ThemeColor = ThemeColor.Accent1 style6(BordersIndex.EdgeBottom).LineStyle = BorderLineStyle.Thick Dim style7 = ws.Range("$B$5:$I$5,$B$15:$I$15,$B$21:$I$21,$B$27:$I$27,$B$31:$I$31,$B$37:$I$37").Borders style7(BordersIndex.EdgeBottom).ThemeColor = ThemeColor.Accent1 style7(BordersIndex.EdgeBottom).LineStyle = BorderLineStyle.Thick Dim style8 = ws.Range("$C$39,$C$41").Borders style8(BordersIndex.EdgeBottom).ThemeColor = ThemeColor.Light2 style8(BordersIndex.EdgeBottom).LineStyle = BorderLineStyle.Medium style8(BordersIndex.EdgeLeft).ThemeColor = ThemeColor.Light2 style8(BordersIndex.EdgeLeft).LineStyle = BorderLineStyle.Medium style8(BordersIndex.EdgeRight).ThemeColor = ThemeColor.Light2 style8(BordersIndex.EdgeRight).LineStyle = BorderLineStyle.Medium style8(BordersIndex.EdgeTop).ThemeColor = ThemeColor.Light2 style8(BordersIndex.EdgeTop).LineStyle = BorderLineStyle.Medium Dim style9 = ws.Range("$E$19,$F$29").Borders style9(BordersIndex.EdgeBottom).ThemeColor = ThemeColor.Light2 style9(BordersIndex.EdgeBottom).LineStyle = BorderLineStyle.Medium style9(BordersIndex.EdgeLeft).ThemeColor = ThemeColor.Light2 style9(BordersIndex.EdgeLeft).LineStyle = BorderLineStyle.Medium style9(BordersIndex.EdgeTop).ThemeColor = ThemeColor.Light2 style9(BordersIndex.EdgeTop).LineStyle = BorderLineStyle.Medium Dim style10 = ws.Range("$F$19,$G$29").Borders style10(BordersIndex.EdgeBottom).ThemeColor = ThemeColor.Light2 style10(BordersIndex.EdgeBottom).LineStyle = BorderLineStyle.Medium style10(BordersIndex.EdgeTop).ThemeColor = ThemeColor.Light2 style10(BordersIndex.EdgeTop).LineStyle = BorderLineStyle.Medium Dim style11 = ws.Range("$G$19,$H$29").Borders style11(BordersIndex.EdgeBottom).ThemeColor = ThemeColor.Light2 style11(BordersIndex.EdgeBottom).LineStyle = BorderLineStyle.Medium style11(BordersIndex.EdgeRight).ThemeColor = ThemeColor.Light2 style11(BordersIndex.EdgeRight).LineStyle = BorderLineStyle.Medium style11(BordersIndex.EdgeTop).ThemeColor = ThemeColor.Light2 style11(BordersIndex.EdgeTop).LineStyle = BorderLineStyle.Medium With ws.Range("$B$3:$I$3") .HorizontalAlignment = HorizontalAlignment.Left .VerticalAlignment = VerticalAlignment.Center .WrapText = True .AddIndent = False End With With ws.Range("$B$8,$C$23:$C$25,$E$29") .VerticalAlignment = VerticalAlignment.Center .AddIndent = False End With With ws.Range("$B$9:$B$13,$B$23:$B$25") .HorizontalAlignment = HorizontalAlignment.Left .VerticalAlignment = VerticalAlignment.Center .AddIndent = False End With With ws.Range("$B$37:$I$37") .HorizontalAlignment = HorizontalAlignment.Left .WrapText = True .AddIndent = False End With With ws.Range("$D$7:$H$7,$E$19:$G$19,$F$29:$H$29") .HorizontalAlignment = HorizontalAlignment.Center .AddIndent = False End With With ws.Range("$I$7") .WrapText = True .AddIndent = False End With ws.Range("$B$3:$I$3").Merge() ws.Range("$E$19:$G$19").Merge() ws.Range("$B$37:$I$37").Merge() ws.Range("$F$29:$H$29").Merge() ws.Range("$1:$1").RowHeight = 20.4R ws.Range("$3:$3").RowHeight = 32.4R ws.Range("$5:$5,$15:$15,$27:$27,$31:$31").RowHeight = 18.0R ws.Range("$7:$7").RowHeight = 57.6R ws.Range("$8:$9,$11:$13").RowHeight = 24.0R ws.Range("$10:$10").RowHeight = 25.2R ws.Range("$17:$21,$39:$39").RowHeight = 18.6R ws.Range("$23:$25").RowHeight = 24.6R ws.Range("$28:$28,$38:$38").RowHeight = 15.6R ws.Range("$29:$29").RowHeight = 27.0R ws.Range("$37:$37").RowHeight = 37.8R ws.Range("$40:$40").RowHeight = 10.2R ws.Range("$41:$41").RowHeight = 19.8R ws.Range("$A:$A").ColumnWidthInPixel = 36.0R ws.Range("$B:$B").ColumnWidthInPixel = 57.0R ws.Range("$C:$C").ColumnWidthInPixel = 260.0R ws.Range("$D:$D").ColumnWidthInPixel = 107.0R ws.Range("$I:$I").ColumnWidthInPixel = 139.0R ws.Range("$J:$J").ColumnWidthInPixel = 48.0R #End Region ' Group: Create and initialize controls ws.Controls.AddGroupBox(266.55, 175.8, 370, 20.4). Text = String.Empty ws.Controls.AddOptionButton(299.95, 178.2, 26.4, 16.19). Text = String.Empty ws.Controls.AddOptionButton(361.8, 178.2, 26.39, 16.19). Text = String.Empty ws.Controls.AddOptionButton(407.8, 178.2, 26.39, 16.19). Text = String.Empty ws.Controls.AddOptionButton(455.2, 177.6, 26.4, 16.2). Text = String.Empty ws.Controls.AddOptionButton(507.4, 178.2, 23.39, 16.19). Text = String.Empty With ws.Controls.AddOptionButton(580, 177.6, 26.39, 16.2) .LinkedCell = ws.Range("$A$8") .Text = String.Empty End With ' Group: Access controls in a worksheet ws.Controls.AddGroupBox(266.55, 199.8, 370, 20.4). Text = String.Empty ws.Controls.AddOptionButton(299.95, 202.2, 26.39, 16.19). Text = String.Empty ws.Controls.AddOptionButton(361.8, 202.2, 26.39, 16.19). Text = String.Empty ws.Controls.AddOptionButton(407.8, 202.2, 26.39, 16.19). Text = String.Empty ws.Controls.AddOptionButton(455.2, 201.6, 26.39, 16.19). Text = String.Empty ws.Controls.AddOptionButton(507.4, 202.2, 23.39, 16.19). Text = String.Empty With ws.Controls.AddOptionButton(580, 201.6, 26.39, 16.19) .LinkedCell = ws.Range("$A$9") .Text = String.Empty End With ' Group: Read/write properties ws.Controls.AddGroupBox(266.55, 223.8, 370, 20.4). Text = String.Empty ws.Controls.AddOptionButton(299.95, 226.2, 26.39, 16.19). Text = String.Empty ws.Controls.AddOptionButton(361.8, 226.2, 26.39, 16.19). Text = String.Empty ws.Controls.AddOptionButton(407.8, 226.2, 26.39, 16.19). Text = String.Empty ws.Controls.AddOptionButton(455.2, 225.6, 26.39, 16.19). Text = String.Empty ws.Controls.AddOptionButton(507.4, 226.2, 23.39, 16.19). Text = String.Empty With ws.Controls.AddOptionButton(580, 225.6, 26.39, 16.19) .LinkedCell = ws.Range("$A$10") .Text = String.Empty End With ' Group: Copy/cut controls ws.Controls.AddGroupBox(266.55, 249, 370, 20.39). Text = String.Empty ws.Controls.AddOptionButton(299.95, 251.4, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(361.8, 251.4, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(407.8, 251.4, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(455.2, 250.79, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(507.4, 251.4, 23.39, 16.2). Text = String.Empty With ws.Controls.AddOptionButton(580, 250.79, 26.39, 16.2) .LinkedCell = ws.Range("$A$11") .Text = String.Empty End With ' Group: Range based data binding ws.Controls.AddGroupBox(266.55, 273, 370, 20.4). Text = String.Empty ws.Controls.AddOptionButton(299.95, 275.4, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(361.8, 275.4, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(407.8, 275.4, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(455.2, 274.8, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(507.4, 275.4, 23.39, 16.2). Text = String.Empty With ws.Controls.AddOptionButton(580, 274.8, 26.39, 16.2) .LinkedCell = ws.Range("$A$12") .Text = String.Empty End With ' Group: Port existing code that uses Excel Form Controls ws.Controls.AddGroupBox(266.55, 297, 370, 20.4). Text = String.Empty ws.Controls.AddOptionButton(299.95, 299.4, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(361.8, 299.4, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(407.8, 299.4, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(455.2, 298.8, 26.39, 16.2). Text = String.Empty ws.Controls.AddOptionButton(507.4, 299.4, 23.39, 16.2). Text = String.Empty With ws.Controls.AddOptionButton(580, 298.8, 26.39, 16.2) .LinkedCell = ws.Range("$A$13") .Text = String.Empty End With Dim ctl29 = ws.Controls.AddCheckBox(28.8, 367.2, 66.75, 16.79) ctl29.Text = "Rich text" Dim ctl30 = ws.Controls.AddCheckBox(29.4, 385.8, 151.35, 16.79) ctl30.Text = "Styles, such as color and lines" Dim ctl31 = ws.Controls.AddCheckBox(29.4, 405.0, 151.35, 16.8) ctl31.Text = "Scale" Dim ctl32 = ws.Controls.AddCheckBox(174.15, 367.8, 175.04, 16.8) ctl32.Text = "Alternative text" Dim ctl33 = ws.Controls.AddCheckBox(174.15, 385.2, 175.04, 16.8) ctl33.Text = "Grouping" Dim ctl34 = ws.Controls.AddCheckBox(174.15, 404.4, 175.04, 16.79) ctl34.Text = "Attach to macros" Dim ctl35 = ws.Controls.AddCheckBox(345.6, 367.8, 165, 16.8) ctl35.Text = "Use formula in buttons" Dim ctl36 = ws.Controls.AddCheckBox(345.6, 385.8, 165, 16.79) ctl36.Text = "Other (please specify)" With ws.Controls.AddSpinner(45.6, 476.4, 17.4, 21) .Max = 3 .Min = 1 .SmallChange = 1 .LinkedCell = ws.Range("$B$23") .Value = 1 End With With ws.Controls.AddSpinner(45.6, 501.0, 17.4, 20.99) .Max = 3 .Min = 1 .SmallChange = 1 .LinkedCell = ws.Range("$B$24") .Value = 2 End With Dim ctl39 = ws.Controls.AddSpinner(45.6, 525.6, 17.4, 21) ctl39.Max = 3 ctl39.Min = 1 ctl39.SmallChange = 1 ctl39.LinkedCell = ws.Range("$B$25") ctl39.Value = 3 With ws.Controls.AddDropDown(30, 599.4, 213.15, 20.39) .DropDownLines = 3 .ItemsSourceRange = ws.Range("$I$28:$I$30") .SelectedIndex = -1 .LinkedCell = ws.Range("$A$29") .Value = 0 End With With ws.Controls.AddScrollBar(31.2, 690.6, 576, 24.6) .LargeChange = 1 .Orientation = FormControlOrientation.Horizontal .Max = 10 .Min = 0 .SmallChange = 1 .LinkedCell = ws.Range("$A$33") .Value = 8 End With With ws.Controls.AddButton(265.35, 851.4, 127.04, 45) .HorizontalTextAlignment = HorizontalAlignment.Center .Orientation = TickLabelOrientation.OrientationHorizontal .VerticalTextAlignment = VerticalAlignment.Center .DefaultButton = True .Text = "Submit" End With Dim ctl57 = ws.Controls.AddLabel(292.35, 671.4, 60.6, 18.0) ctl57.Text = "I'm not sure" Dim ctl58 = ws.Controls.AddLabel(433.8, 672.6, 66.59, 18.6) ctl58.Text = "Likely" Dim ctl59 = ws.Controls.AddLabel(143.55, 672.0, 60.59, 18.6) ctl59.Text = "Unlikely" ' save to an excel file workbook.Save("FeedbackForm.xlsx")