Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Charting / October 2005

Tip: Looking for answers? Try searching our database.

Bolding Part Of A Title By Code....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob Barnes - 26 Oct 2005 22:01 GMT
Here is a snippet of code I use when Opening a Workbook...

ActiveSheet.ChartObjects("Chart 4").Activate
ActiveChart.ChartTitle.Text = "ABC Total For " _
& Worksheets("TheChart").Range("Title").Value
ActiveChart.ChartArea.Select: ActiveChart.HasLegend = False

Can I BOLD "ABC" above AND the entry that's stored in the Named
Range "Title"???

TIA - Bob
Jon Peltier - 27 Oct 2005 04:24 GMT
Bob -

Try this:

Sub FormatTitle()
  Const sPREFIX1 As String = "ABC "
  Const sPREFIX2 As String = "Total For "

  ActiveChart.ChartTitle.Text = sPREFIX1 & sPREFIX2 _
    & Worksheets("TheChart").Range("TheTitle").Value
  ActiveChart.ChartTitle.Font.Bold = False
  ActiveChart.ChartTitle.Characters(1, Len(sPREFIX1)).Font.Bold = True
  ActiveChart.ChartTitle.Characters(1 + Len(sPREFIX1) +
Len(sPREFIX2)).Font.Bold = True
End Sub

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

> Here is a snippet of code I use when Opening a Workbook...
>
[quoted text clipped - 7 lines]
>
> TIA - Bob
Bob Barnes - 27 Oct 2005 15:46 GMT
Jon - THANK you.

You are a Chart ACE.

I was wondering if you would see & reply.

Bob

> Bob -
>
[quoted text clipped - 31 lines]
> >
> > TIA - Bob
Bob Barnes - 28 Oct 2005 02:00 GMT
Jon - I'm getting a runtime User-defined error for...

ActiveChart.ChartTitle.Text = sPREFIX1 & sPREFIX2 _
& Worksheets("TheChart").Range("TheTitle").Value

TIA - Bob

> Bob -
>
[quoted text clipped - 31 lines]
> >
> > TIA - Bob
Jon Peltier - 28 Oct 2005 04:13 GMT
1. Is a chart selected?
2. Does the selected chart have a title? I've inserted a line in the new
version of the macro, which should have been there anyway, just in case.:

Sub FormatTitle()
  Const sPREFIX1 As String = "ABC "
  Const sPREFIX2 As String = "Total For "

  ActiveChart.HasTitle = True
  ActiveChart.ChartTitle.Text = sPREFIX1 & sPREFIX2 _
    & Worksheets("TheChart").Range("TheTitle").Value
  ActiveChart.ChartTitle.Font.Bold = False
  ActiveChart.ChartTitle.Characters(1, Len(sPREFIX1)).Font.Bold = True
  ActiveChart.ChartTitle.Characters(1 + Len(sPREFIX1) +
Len(sPREFIX2)).Font.Bold = True
End Sub

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

> Jon - I'm getting a runtime User-defined error for...
>
[quoted text clipped - 38 lines]
>>>
>>>TIA - Bob
Bob Barnes - 28 Oct 2005 15:49 GMT
Jon - It STILL gives Error 1004 = User-defined error.

Here's my snippet...
Sheets("TheChart").Select
ActiveSheet.ChartObjects("Chart 4").Activate
Const sPREFIX1 As String = "ABC "
Const sPREFIX2 As String = "Total For "
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = sPREFIX1 & sPREFIX2 _
& Worksheets("TheChart").Range("TheTitle").Value

It fails at the "last line" above..

TIA - Bob

> 1. Is a chart selected?
> 2. Does the selected chart have a title? I've inserted a line in the new
[quoted text clipped - 63 lines]
> >>>
> >>>TIA - Bob
Bob Barnes - 28 Oct 2005 16:46 GMT
Jon - It appears to be WORKING now.

Perhaps, when stepping thru (testing the Access-to-Excel
Automation), something caused the Error 1004.  It's OK now.

THANK you - Bob

> Jon - It STILL gives Error 1004 = User-defined error.
>
[quoted text clipped - 78 lines]
> > >>>
> > >>>TIA - Bob
Jon Peltier - 29 Oct 2005 02:40 GMT
Step by step...

Is there a worksheet named "TheChart"?
Does it contain a range named "TheTitle"?
Insert a few temporary lines:

  MsgBox sPREFIX1
  MsgBox sPREFIX2
  MsgBox Worksheets("TheChart").Range("TheTitle").Value

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

> Jon - It STILL gives Error 1004 = User-defined error.
>
[quoted text clipped - 78 lines]
>>>>>
>>>>>TIA - Bob
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.