If you have used an ActiveX control, then: It is much easier to create a special button. To run it, you need to go to the «DEVELOPER» menu every time, which is inconvenient. Now you need to make it “able to work”.įor example, you have created a macro to perform a specific task. The options that are available on the computer will be offered to choose from. In the «Illustrations» menu, select the «Pictures» tool. You can right-click the finished shape and change its formatting. In the «Recently Used Shapes» menu, select the appropriate shape. The window for assigning a macro opens immediately: you can assign it right now or later at your option.
Now select the «Button (Form Control)» element from the first group (the same gray-colored brick). Now draw the button of the required size using the cursor. You need to select the first ActiveX element, that is depicted in in the form of a gray brick. The menu with a set of items to insert will open. Ways to create a graphic object in Excel: Let's consider the order of actions in detail. I don't know how I should write this in C# because I don't have the same methods.The essence of the work lies in creating a graphic object and assigning a macro or hyperlink to it.
HOW TO CREATE A HISTOGRAM IN EXCEL 2016 MACRO CODE
Which is, in my opinion, totally different compared to the way I try it in my code example. When I tried to record a macro for creating a histogram, I get following commands: Sub Makro1()Ī(Array("Chart 1")).Select Var charts = xlWorkSheetDia.ChartObjects() as Excel.ChartObjects System.IO.File.Copy(sourceFileName: path, destFileName: destPath, overwrite: true) // use txt file instead of csv, for correct delimiter parsing XlApp.Visible = true //Set status for word application is to be visible or not. String path = destPath = an instance for word appĮxcel.Application xlApp = new Excel.Application() Įxcel.Worksheet xlWorkSheetDia, xlWorkSheetData
But I get an out of range exception when applying the chart type. I looked up the enumerator number with the object explorer, it also is 118 (decimal). I tried looking up the enumerator and creating it by myself following the suggestions in this question: C# - why Histogram does not work in Excel 2016? The main problem I have is creating the histogram chart because Excel.XlChartTypedoes not suggest me the xlHistogramEnumerator. I want to create a histogram on a already existent spreadsheet xlWorkSheetDia which displays data in the spreadsheet xlWorkSheetData.