Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Setting up default chart properties

Is it possible to modify some of the default chart properties through
VBA somehow? - I'm thinking particlarly about the border property of
the plot area and legend. These are common to all types of chart so I
can't use the "Default Chart" because that's too specific - I need to
modify the base set of initialisation properties that Excel uses when
inserting a new chart, so that no matter what type of chart the user
wants to create, it doesn't have a border.

Alternatively, is there an event I can listen on for when a new chart
is inserted so that I could run some code to fix these properties each
time.

Thanks in advance

Craig
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Setting up default chart properties

Craig -

You can modify charts in VBA easily enough. Turn on the macro recorder,
then modify one, to see what kind of code you'd use.

Detecting a chart creation event is problematic. I've never figured out
what event is fired when a chart sheet is created or a chart is embedded
in a sheet.

But you can intercept the chart wizard. These two macros do the trick.
The first one substitutes a lookalike button for the chart wizard
button, which runs the second macro. The second macro actually runs the
chart wizard, but when the wiz is done, you still have control.

Sub ReplaceChartWizardButton()
Dim MyButton As CommandBarButton
Set MyButton = CommandBars("Standard").Controls.Add _
(Type:=msoControlButton, _
befo=CommandBars("Standard").Controls("&Chart Wizard"). _
Index + 1)
With MyButton
.Caption = "Fake Chart Wizard"
.Style = msoButtonIcon
.OnAction = "FauxChartWizard"
.FaceId = 1957
End With
CommandBars("Standard").Controls("&Chart Wizard").Visible = False
End Sub

Sub FauxChartWizard()
Dim chtwiz As CommandBarControl
On Error Resume Next
Set chtwiz = Application.CommandBars.FindControl(Id:=436)
chtwiz.Execute
'' dummy command to see if it works
ActiveChart.Parent.Left = 0
End Sub

Apply whatever formatting you need where I inserted the line
ActiveChart.Parent.Left = 0

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

CraigB wrote:
Is it possible to modify some of the default chart properties through
VBA somehow? - I'm thinking particlarly about the border property of
the plot area and legend. These are common to all types of chart so I
can't use the "Default Chart" because that's too specific - I need to
modify the base set of initialisation properties that Excel uses when
inserting a new chart, so that no matter what type of chart the user
wants to create, it doesn't have a border.

Alternatively, is there an event I can listen on for when a new chart
is inserted so that I could run some code to fix these properties each
time.

Thanks in advance

Craig


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting the default properties for cells in all new spreadsheets Bon Bon Excel Discussion (Misc queries) 1 March 20th 10 01:01 PM
Setting up a Custom type, User-defined, Default Chart Kurt Charts and Charting in Excel 0 December 22nd 05 07:43 PM
Setting and KEEPING the default chart redbelly Charts and Charting in Excel 0 June 30th 05 02:35 PM
How can I set up the default setting of a chart display? Change Default Chart settings Setting up and Configuration of Excel 1 June 17th 05 10:59 PM
Setting default pivot table field setting to "sum" Mr. Moose Excel Discussion (Misc queries) 2 December 21st 04 04:43 PM


All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"