Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Viv2004
 
Posts: n/a
Default Has anyone had problems setting the font size for a title through VBA?


I have some VBA code that makes multiple copies of a chart object and
then populates the chart with series and title information.
Unfortunately, the font size for the chart title keeps on getting reset
to 16.5, even though I set it to 12 via VBA. I have no idea why this is,
and no error is listed. Any ideas on how to fix this would be really
welcome.

Further details:

Code used to duplicate the original chart object

Set co2 = co.Duplicate

Code used to rename and change font

co2.Chart.ChartTitle.Text = cYNav.getName
co2.Chart.ChartTitle.Font.Size = 12

where co2 is a ChartObject
cYNav is an object I created to store some info.

Thank you for your help.

Regards,

Viv.


--
Viv2004
------------------------------------------------------------------------
Viv2004's Profile: http://www.excelforum.com/member.php...o&userid=26511
View this thread: http://www.excelforum.com/showthread...hreadid=397944

  #2   Report Post  
Jon Peltier
 
Posts: n/a
Default

Does it help to include this line?

co2.Chart.ChartTitle.AutoScaleFont = False

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

Viv2004 wrote:

I have some VBA code that makes multiple copies of a chart object and
then populates the chart with series and title information.
Unfortunately, the font size for the chart title keeps on getting reset
to 16.5, even though I set it to 12 via VBA. I have no idea why this is,
and no error is listed. Any ideas on how to fix this would be really
welcome.

Further details:

Code used to duplicate the original chart object

Set co2 = co.Duplicate

Code used to rename and change font

co2.Chart.ChartTitle.Text = cYNav.getName
co2.Chart.ChartTitle.Font.Size = 12

where co2 is a ChartObject
cYNav is an object I created to store some info.

Thank you for your help.

Regards,

Viv.



  #3   Report Post  
Mike Middleton
 
Posts: n/a
Default

Viv2004 -

I have some VBA code that makes multiple copies of a chart object and then
populates the chart with series and title information. Unfortunately, the
font size for the chart title keeps on getting reset to 16.5, even though
I set it to 12 via VBA. I have no idea why this is, and no error is
listed. Any ideas on how to fix this would be really welcome. <


If it's the active chart, try

ActiveChart.ChartTitle.AutoScaleFont = False

Or, adapt to your situation.

- Mike
www.mikemiddleton.com


  #4   Report Post  
Viv2004
 
Posts: n/a
Default


Mike & Jon, that worked perfectly and solved the problem. Thank you very
much for your help!

Regards,

Viv.


--
Viv2004
------------------------------------------------------------------------
Viv2004's Profile: http://www.excelforum.com/member.php...o&userid=26511
View this thread: http://www.excelforum.com/showthread...hreadid=397944

  #5   Report Post  
Dave Koehler
 
Posts: n/a
Default

On Mon, 22 Aug 2005 16:57:49 -0500, Viv2004
wrote:

Hopefully, this is on point. I've noticed with the following code,
that if I change the font size of a portion of the chart title, I get
two curious conditions. First off, the plot area grows in size and
climbs up the page by a few units for each invocation of the macro.
Say for the first time thru, the height = 300. On successive passes
thru the macro, it will be 304, then 307, 311, etc., until it fills up
the entire chart area. Also, the fonts on all axes and titles begins
to autoscale down to ever smaller sizes to the point they become
microscopic.

All fonts are set to autoscale from a maximum window size of 10pt with
exception to the first part of the .ChartTitle.Text which is set on
the graph directly to a 20pt size.

I solved the first issue by forcing the plot area to fixed height and
plot values. The disappearing font size remains still, even with the
constant plot area height. Could the issue be the difference in font
sizes within the title.

Would like to keep as much autoscaling on as possible as the people
that use this chart have very busy desktops and usually resize the
Excel windows a lot.

remove the XXX in the email address to chat with me

---dave


With wsTrend
.HasTitle = True
With .ChartTitle
.Text = "S0 - DC2007" & vbCr & strAppl & vbCr & strPart & _
" " & strDept & " Date: " & Format(Now, "mm/dd/yyyy")
x = InStr(.Text, "P.N.")
y = Len(.Text)
.Characters(start:=x, Length:=y).Font.Size = 14
End With
With .Axes(xlCategory, xlPrimary)
.HasTitle = True
.AxisTitle.Characters.Text = strTitle
.TickLabelSpacing = wsData.[X_Scale]
End With
With .Axes(xlValue, xlPrimary)
.HasTitle = True
.AxisTitle.Characters.Text = wsData.[Unit_1st]
.MinimumScale = wsData.[Y_Scale]
End With
With .PlotArea
Msgbox .Height & " " & .Top
' .Height = 300
'.Top = 100
End With
End With



I have some VBA code that makes multiple copies of a chart object and
then populates the chart with series and title information.
Unfortunately, the font size for the chart title keeps on getting reset
to 16.5, even though I set it to 12 via VBA. I have no idea why this is,
and no error is listed. Any ideas on how to fix this would be really
welcome.

Further details:

Code used to duplicate the original chart object

Set co2 = co.Duplicate

Code used to rename and change font

co2.Chart.ChartTitle.Text = cYNav.getName
co2.Chart.ChartTitle.Font.Size = 12

where co2 is a ChartObject
cYNav is an object I created to store some info.

Thank you for your help.

Regards,

Viv.

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
Font size geza Excel Worksheet Functions 2 June 3rd 05 08:20 PM
Font size prints same size regardless of how I set it in Excel Marcusmouse Excel Discussion (Misc queries) 2 May 26th 05 04:25 PM
How to change the default font and size of "comments"? ClayMcQ Excel Discussion (Misc queries) 1 January 8th 05 12:43 AM
Changing font size in a list box [email protected] Excel Discussion (Misc queries) 1 December 21st 04 05:07 PM
Change datalabel font size for all chartobjects in a row Marie J-son Charts and Charting in Excel 2 December 5th 04 08:02 PM


All times are GMT +1. The time now is 10:26 AM.

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

About Us

"It's about Microsoft Excel"