View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Ramage[_2_] Dave Ramage[_2_] is offline
external usenet poster
 
Posts: 41
Default URGENT - NEED EXCEL PROGRAMMER - AUTOMATE THE TITLES IN MY EXCEL GRAPHS

Marcello,

Here are two bits of code that should suit. Use AddTitle1
if your chart is on a separate chart sheet. Use AddTitle2
if the chart is embedded in a ChartObject on a worksheet.
Change the sheet names and ranges as required and it
should do what you need.

Sub AddTitle1()
Dim strName As String, strSubject As String
Dim dtStart As Date, dtEnd As Date
Dim chrt As Chart, ws As Worksheet

Set ws = ActiveWorkbook.Sheets("Sheet1")
strName = ws.Range("A1").Value
strSubject = "Summary For Year"
dtStart = ws.Range("A2").Value
dtEnd = ws.Range("A3").Value

Set chrt = ActiveWorkbook.Charts(1)
chrt.HasTitle = True
chrt.ChartTitle.Characters.Text = strName & "- " &
strSubject & ", " _
& Format(dtStart, "dd-mmm-yy") & " to " & Format
(dtEnd, "dd-mmm-yy")
End Sub

Sub AddTitle2()
Dim strName As String, strSubject As String
Dim dtStart As Date, dtEnd As Date
Dim chrt As Chart, ws As Worksheet

Set ws = ActiveWorkbook.Sheets("Sheet1")
strName = ws.Range("A1").Value
strSubject = "Summary For Year"
dtStart = ws.Range("A2").Value
dtEnd = ws.Range("A3").Value

Set chrt = ActiveWorkbook.Sheets("Sheet1").ChartObjects
(1).Chart
chrt.HasTitle = True
chrt.ChartTitle.Characters.Text = strName & "- " &
strSubject & ", " _
& Format(dtStart, "dd-mmm-yy") & " to " & Format
(dtEnd, "dd-mmm-yy")
End Sub

Cheers,
Dave
-----Original Message-----
I am on the verge of releasing an Excel-based application

for tanning
salons and spas. This is the mother of applications, but

I need to add
automation to my graphs.

I need to automate the graphs that I have in my

application so that
the title automatically reflects:

1. Customer Name
2. Subject of Graph
3. Date Covered By Graph

My application already has the customer name and date

appear at the
top of each spreadsheet. My problem is taking that

information and
using it so that it appears in the title of my graphs.

I need someone who nows how to do this and can show me

how to do this
either in person or over the telephone. I am willing to

pay for this
service. Show me how to do one and I can do the rest.

If you live within the San Francisco Bay Area this would

be better.

You may contact me through my email which is:



Please leave your name, where you live and a telephone

number plus
best time to reach you.

I need to have this done ASAP.

Sincerely,



Marcello
.