VBA Excel: The specified dimension is not valid for the current chart type -
I am trying to save the Axel diagram with VBA as the image I call multiple workbooks with the whole code Let me see all the worksheets and save all the pictures. The following code works with Excel 2007 and 2010 (but there is a horizon and a vertical line is visible due to + 4). If I change round (SP width + 4, 0) to round (SP width, 0) then I get the following error in 2010 (but not in 2007):
Run-time error -2147467259 (80004005) ': The specified dimension for the current chart type is not valid.
Worksheet set as Shape Sheet in the form of shak sht = Application.ActiveWorkbook.Sheets (shtName) set shp = sht.Shapes (chrtName) shp.CopyPicture xlScreen, xlBitmap Dim objChart Activate the chart object as objChart = Sht.ChartObjects.Add (200, 200, round (shp.Width + 4, 0), round (shp.Height + 4, 0) objChart.ActiveChart. Activate ActivePart.Paste file Name: = Full text, Filtername: = true (full text, 3) objChart.Delete Does anyone know how I can use 4?
The following was found:
"The problem occurs whenever the default For example, if you try to create a line chart and if the default chart in Excel is OHLC (Candlestick Stock Chart) then Excel will complain that you are trying to create the chart type other than those you are trying to create. Will be faster for "the specified dimension is not valid for the current chart type." That happens whenever you try to create a chart from VB.NET. Therefore, first of all, Dassault chart type will be resolved as a change in the basic chart type line chart. "
But I do not know how to do it with VBA.
Use the
set objChart = Worksheet.Shapes.AddChart2 () chart.Parent instead of
< Code> Set up objChart = worksheet .ChartObjects.Add ()
The former task allows you to specify a basic chart type in the second argument. < / Html>
Comments
Post a Comment