Hi everybody,
i have a question regarding chart creation in excel. i have the following code to create a chart and resize the plot area. what my problem is, while creating the chart we can see how it is being resized. i don't want users to see what it is doin. as soon as it is done with the chart i want to show it.
any help will be greatly appreciated
here is the code
Private Sub CommandButton1_Click()
fname = "test.xls"
sh1 = "Sheet1"
Workbooks.Open Filename:="C:\karen\test.xls"
Charts.Add
With ActiveChart
.ChartType = xlXYScatterSmoothNoMarkers
.SetSourceData Source:=Sheets(sh1).Range("E10:F14"
, PlotBy _
:=xlColumns
.Location Where:=xlLocationAsNewSheet, Name:="result"
.HasTitle = True
.ChartTitle.Characters.Text = "title"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "x"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "y"
.HasLegend = False
.ChartArea.Border.Weight = xlHairline
.ChartArea.Border.LineStyle = xlAutomatic
.PageSetup.LeftMargin = Application.InchesToPoints(0.5)
.PageSetup.RightMargin = Application.InchesToPoints(0.5)
.PageSetup.TopMargin = Application.InchesToPoints(0.5)
.PageSetup.BottomMargin = Application.InchesToPoints(0.5)
.PageSetup.HeaderMargin = Application.InchesToPoints(0.5)
.PageSetup.FooterMargin = Application.InchesToPoints(0.5)
.PlotArea.Border.Weight = xlThin
.PlotArea.Border.LineStyle = xlAutomatic
.PlotArea.Interior.ColorIndex = 2
.PlotArea.Interior.PatternColorIndex = 1
.PlotArea.Interior.Pattern = xlSolid
.PlotArea.Width = 265
.PlotArea.Height = 232
.PlotArea.Left = 28
.PlotArea.Top = 45
.Axes(xlValue).Border.Weight = xlHairline
.Axes(xlValue).Border.LineStyle = xlAutomatic
.Axes(xlValue).MajorTickMark = xlOutside
.Axes(xlValue).MinorTickMark = xlNone
.Axes(xlValue).TickLabelPosition = xlLow
.Axes(xlValue).TickLabels.AutoScaleFont = True
.Axes(xlValue).TickLabels.Font.Name = "Arial"
.Axes(xlValue).TickLabels.Font.FontStyle = "Regular"
.Axes(xlValue).TickLabels.Font.Size = 9
.Axes(xlCategory).TickLabels.AutoScaleFont = True
.Axes(xlCategory).TickLabels.Font.Name = "Arial"
.Axes(xlCategory).TickLabels.Font.FontStyle = "Regular"
.Axes(xlCategory).TickLabels.Font.Size = 9
.Axes(xlCategory).AxisTitle.AutoScaleFont = True
.Axes(xlCategory).AxisTitle.Font.Name = "Arial"
.Axes(xlCategory).AxisTitle.Font.FontStyle = "Bold"
.Axes(xlCategory).AxisTitle.Font.Size = 9
.Axes(xlCategory).HasMajorGridlines = True
.Axes(xlCategory).HasMinorGridlines = False
.Axes(xlValue).AxisTitle.AutoScaleFont = True
.Axes(xlValue).AxisTitle.Font.Name = "Arial"
.Axes(xlValue).AxisTitle.Font.FontStyle = "Bold"
.Axes(xlValue).AxisTitle.Font.Size = 9
.Axes(xlValue).HasMajorGridlines = True
.Axes(xlValue).HasMinorGridlines = False
End With
End Sub
karen
i have a question regarding chart creation in excel. i have the following code to create a chart and resize the plot area. what my problem is, while creating the chart we can see how it is being resized. i don't want users to see what it is doin. as soon as it is done with the chart i want to show it.
any help will be greatly appreciated
here is the code
Private Sub CommandButton1_Click()
fname = "test.xls"
sh1 = "Sheet1"
Workbooks.Open Filename:="C:\karen\test.xls"
Charts.Add
With ActiveChart
.ChartType = xlXYScatterSmoothNoMarkers
.SetSourceData Source:=Sheets(sh1).Range("E10:F14"
:=xlColumns
.Location Where:=xlLocationAsNewSheet, Name:="result"
.HasTitle = True
.ChartTitle.Characters.Text = "title"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "x"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "y"
.HasLegend = False
.ChartArea.Border.Weight = xlHairline
.ChartArea.Border.LineStyle = xlAutomatic
.PageSetup.LeftMargin = Application.InchesToPoints(0.5)
.PageSetup.RightMargin = Application.InchesToPoints(0.5)
.PageSetup.TopMargin = Application.InchesToPoints(0.5)
.PageSetup.BottomMargin = Application.InchesToPoints(0.5)
.PageSetup.HeaderMargin = Application.InchesToPoints(0.5)
.PageSetup.FooterMargin = Application.InchesToPoints(0.5)
.PlotArea.Border.Weight = xlThin
.PlotArea.Border.LineStyle = xlAutomatic
.PlotArea.Interior.ColorIndex = 2
.PlotArea.Interior.PatternColorIndex = 1
.PlotArea.Interior.Pattern = xlSolid
.PlotArea.Width = 265
.PlotArea.Height = 232
.PlotArea.Left = 28
.PlotArea.Top = 45
.Axes(xlValue).Border.Weight = xlHairline
.Axes(xlValue).Border.LineStyle = xlAutomatic
.Axes(xlValue).MajorTickMark = xlOutside
.Axes(xlValue).MinorTickMark = xlNone
.Axes(xlValue).TickLabelPosition = xlLow
.Axes(xlValue).TickLabels.AutoScaleFont = True
.Axes(xlValue).TickLabels.Font.Name = "Arial"
.Axes(xlValue).TickLabels.Font.FontStyle = "Regular"
.Axes(xlValue).TickLabels.Font.Size = 9
.Axes(xlCategory).TickLabels.AutoScaleFont = True
.Axes(xlCategory).TickLabels.Font.Name = "Arial"
.Axes(xlCategory).TickLabels.Font.FontStyle = "Regular"
.Axes(xlCategory).TickLabels.Font.Size = 9
.Axes(xlCategory).AxisTitle.AutoScaleFont = True
.Axes(xlCategory).AxisTitle.Font.Name = "Arial"
.Axes(xlCategory).AxisTitle.Font.FontStyle = "Bold"
.Axes(xlCategory).AxisTitle.Font.Size = 9
.Axes(xlCategory).HasMajorGridlines = True
.Axes(xlCategory).HasMinorGridlines = False
.Axes(xlValue).AxisTitle.AutoScaleFont = True
.Axes(xlValue).AxisTitle.Font.Name = "Arial"
.Axes(xlValue).AxisTitle.Font.FontStyle = "Bold"
.Axes(xlValue).AxisTitle.Font.Size = 9
.Axes(xlValue).HasMajorGridlines = True
.Axes(xlValue).HasMinorGridlines = False
End With
End Sub
karen