PC Review


Reply
Thread Tools Rate Thread

Applying custom chart type

 
 
IgorM
Guest
Posts: n/a
 
      9th Dec 2008

Hi

I have a pivot-chart that I want to have it formatted with my custom chart
type. I have the type created (and saved) but I'm struggiling with the code
responsible for reapplying the type whenever user selectes different item
from the drop-down lists on the chart. I used a recorded code that is as
follows:
Private Sub Chart_Calculate()
ApplyCustomChartType
End Sub

Private Sub ApplyCustomChartType()
Application.Calculation = xlCalculationManual
ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:= _
"Raport sprzedaży"
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
Application.Calculation = xlCalculationAutomatic
End Sub

Unfortunatelly the line ActiveChart.ApplyCustomType
ChartType:=xlUserDefined, TypeName:= "Raport sprzedaży" triggers the
Chart_Calculate event so the whole macro runs in endless loop.
How can fix this. Kind regards

Igor


 
Reply With Quote
 
 
 
 
Stefi
Guest
Posts: n/a
 
      9th Dec 2008

Try
Application.EnableEvents =False
at the beginning of the sub and set it back to True at the end.

Regards,
Stefi


„IgorM” ezt Ă*rta:

> Hi
>
> I have a pivot-chart that I want to have it formatted with my custom chart
> type. I have the type created (and saved) but I'm struggiling with the code
> responsible for reapplying the type whenever user selectes different item
> from the drop-down lists on the chart. I used a recorded code that is as
> follows:
> Private Sub Chart_Calculate()
> ApplyCustomChartType
> End Sub
>
> Private Sub ApplyCustomChartType()
> Application.Calculation = xlCalculationManual
> ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:= _
> "Raport sprzedaÂży"
> ActiveChart.Location Where:=xlLocationAsNewSheet
> With ActiveChart.Axes(xlCategory)
> .HasMajorGridlines = False
> .HasMinorGridlines = False
> End With
> With ActiveChart.Axes(xlValue)
> .HasMajorGridlines = True
> .HasMinorGridlines = False
> End With
> Application.Calculation = xlCalculationAutomatic
> End Sub
>
> Unfortunatelly the line ActiveChart.ApplyCustomType
> ChartType:=xlUserDefined, TypeName:= "Raport sprzedaÂży" triggers the
> Chart_Calculate event so the whole macro runs in endless loop.
> How can fix this. Kind regards
>
> Igor
>
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom type chart Ask MS Microsoft Excel Worksheet Functions 2 25th Jun 2008 12:28 AM
Bug in applying custom chart templates in PP2007? Luca Brasi Microsoft Powerpoint 1 17th Sep 2007 09:37 PM
Apply custom chart type - VBA Fredrik E. Nilsen Microsoft Excel Programming 5 20th Apr 2007 04:52 PM
Apply custom chart type - VBA Fredrik E. Nilsen Microsoft Excel Charting 5 20th Apr 2007 04:52 PM
Macro applying custom animation to chart does not record =?Utf-8?B?Tmlja0NM?= Microsoft Powerpoint 3 3rd Aug 2005 07:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:53 PM.