Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Input box and carriage return for chart title

I'm using excel 2000. Can someone help me revise the following code to
allow for a carriage return by the user while inputting text for the chart
title. Or is there an easier method that allows a user to enter a title
into a chart besides a message box?

Joel Mills

Sub ChartHeader()
'
ActiveSheet.ChartObjects("Curve Chart").Activate
ActiveChart.ChartArea.Select
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = InputBox("Enter the Chart Title Here"
& vbCr & _
"after creating the title select" & vbCr & " where you want to start a
new line |" _
& vbCr & "and hit enter to force a to a new line.")
End With

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Input box and carriage return for chart title

Joel,

I don't believe there is a way to force a carriage return
during text entry in an Input box.
However, you can put one in after the entry is complete.
Note: the following code will only force one additional line...

'-----------------------------
Sub SplitInputBoxText()
Dim strInput As String
Dim lngDot As Long

strInput = InputBox("Enter the Chart Title below." & vbCr & _
"A new line will automatically be started after a period (dot).", _
"Enter Chart Title", "Chart Title")
If Len(strInput) = 0 Then
Exit Sub
Else
lngDot = InStr(1, strInput, ".", vbTextCompare)
If lngDot 1 Then
strInput = Left$(strInput, lngDot) & vbCr & _
LTrim$(Right$(strInput, Len(strInput) - lngDot))
End If
End If

MsgBox strInput
End Sub
'--------------------

Regards,
Jim Cone
San Francisco, USA



"Joel Mills" wrote in message
...
I'm using excel 2000. Can someone help me revise the following code to
allow for a carriage return by the user while inputting text for the chart
title. Or is there an easier method that allows a user to enter a title
into a chart besides a message box?
Joel Mills

Sub ChartHeader()
ActiveSheet.ChartObjects("Curve Chart").Activate
ActiveChart.ChartArea.Select
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = InputBox("Enter the Chart Title Here"
& vbCr & _
"after creating the title select" & vbCr & " where you want to start a
new line |" _
& vbCr & "and hit enter to force a to a new line.")
End With
End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Input box and carriage return for chart title

Jim, thanks for your reply. I think the users will just have to input a
carriage return into the Chart Title as they would if they created the chart
using chart wizard.


"Jim Cone" wrote in message
...
Joel,

I don't believe there is a way to force a carriage return
during text entry in an Input box.
However, you can put one in after the entry is complete.
Note: the following code will only force one additional line...

'-----------------------------
Sub SplitInputBoxText()
Dim strInput As String
Dim lngDot As Long

strInput = InputBox("Enter the Chart Title below." & vbCr & _
"A new line will automatically be started after a period (dot).", _
"Enter Chart Title", "Chart Title")
If Len(strInput) = 0 Then
Exit Sub
Else
lngDot = InStr(1, strInput, ".", vbTextCompare)
If lngDot 1 Then
strInput = Left$(strInput, lngDot) & vbCr & _
LTrim$(Right$(strInput, Len(strInput) - lngDot))
End If
End If

MsgBox strInput
End Sub
'--------------------

Regards,
Jim Cone
San Francisco, USA



"Joel Mills" wrote in message
...
I'm using excel 2000. Can someone help me revise the following code to
allow for a carriage return by the user while inputting text for the chart
title. Or is there an easier method that allows a user to enter a title
into a chart besides a message box?
Joel Mills

Sub ChartHeader()
ActiveSheet.ChartObjects("Curve Chart").Activate
ActiveChart.ChartArea.Select
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = InputBox("Enter the Chart Title Here"
& vbCr & _
"after creating the title select" & vbCr & " where you want to start a
new line |" _
& vbCr & "and hit enter to force a to a new line.")
End With
End Sub



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
Carriage return CWH Excel Discussion (Misc queries) 1 March 16th 10 01:54 PM
Carriage Return Freddo Excel Worksheet Functions 2 March 22nd 07 10:34 AM
Carriage return in a cell Jos Vens[_2_] Excel Programming 2 November 25th 04 10:03 AM
Creating carriage returns in msg or input boxes Michael Excel Programming 4 June 4th 04 02:08 PM
Carriage Return Tom Ogilvy Excel Programming 3 August 20th 03 07:22 PM


All times are GMT +1. The time now is 02:17 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"