Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Sentence Capitalizatio

Greetings,

How Do I use "Application.AutoCorrect.CorrectSentenceCap". I can't
seem to get it to work!

Or is there a different way to get the contents of a TextBox to
convert to correct sentence structure with the first letter of each
sentence to be capitalized and the rest lower case?

Any help will be appreciated.

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Sentence Capitalizatio

this may do what you want

Sub test()
With Range("A1")
.Value = LCase(.Value)
.Value = UCase(Left(.Value, 1)) & Mid(.Value, 2, Len(.Value))
End With
End Sub


--


Gary


"Minitman" wrote in message
...
Greetings,

How Do I use "Application.AutoCorrect.CorrectSentenceCap". I can't
seem to get it to work!

Or is there a different way to get the contents of a TextBox to
convert to correct sentence structure with the first letter of each
sentence to be capitalized and the rest lower case?

Any help will be appreciated.

-Minitman



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Sentence Capitalizatio

this will do the same thing,
With Range("A1")
.Value = UCase(Left(.Value, 1)) & Mid(LCase(.Value), 2, Len(.Value))
End With

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
this may do what you want

Sub test()
With Range("A1")
.Value = LCase(.Value)
.Value = UCase(Left(.Value, 1)) & Mid(.Value, 2, Len(.Value))
End With
End Sub


--


Gary


"Minitman" wrote in message
...
Greetings,

How Do I use "Application.AutoCorrect.CorrectSentenceCap". I can't
seem to get it to work!

Or is there a different way to get the contents of a TextBox to
convert to correct sentence structure with the first letter of each
sentence to be capitalized and the rest lower case?

Any help will be appreciated.

-Minitman





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Sentence Capitalizatio

Hey Gary,

Thanks for the reply.

If I understand your code, it is forcing the format of cell A1 into
the 1st character being uppercase, and everything else to be
lowercase, is that correct?

I think a better description of my problem is in order

First, these TextBoxes are on a UserForm, not a sheet.
Second, the TextBoxes are being used as memo fields. There could be
many sentences in 1 TextBox not just one.

I was given code snippet as a possible solution awhile back, but I
didn't check it out:

TextBox1.Text = Application.AutoCorrect.CorrectSentenceCap = True

This appears to only turn on the AutoCorrect.CorrectSentenceCap
property according to the MS help file. Other then that, I don't
know!

Any other ideas?

-Minitman



On Sun, 6 Jul 2008 20:17:11 -0400, "Gary Keramidas"
<GKeramidasATmsn.com wrote:

this will do the same thing,
With Range("A1")
.Value = UCase(Left(.Value, 1)) & Mid(LCase(.Value), 2, Len(.Value))
End With

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
this may do what you want

Sub test()
With Range("A1")
.Value = LCase(.Value)
.Value = UCase(Left(.Value, 1)) & Mid(.Value, 2, Len(.Value))
End With
End Sub


--


Gary


"Minitman" wrote in message
...
Greetings,

How Do I use "Application.AutoCorrect.CorrectSentenceCap". I can't
seem to get it to work!

Or is there a different way to get the contents of a TextBox to
convert to correct sentence structure with the first letter of each
sentence to be capitalized and the rest lower case?

Any help will be appreciated.

-Minitman





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Sentence Capitalizatio

somebody posted an answer last year for you. did it work?

http://www.ozgrid.com/forum/showthread.php?t=77385

--


Gary


"Minitman" wrote in message
...
Hey Gary,

Thanks for the reply.

If I understand your code, it is forcing the format of cell A1 into
the 1st character being uppercase, and everything else to be
lowercase, is that correct?

I think a better description of my problem is in order

First, these TextBoxes are on a UserForm, not a sheet.
Second, the TextBoxes are being used as memo fields. There could be
many sentences in 1 TextBox not just one.

I was given code snippet as a possible solution awhile back, but I
didn't check it out:

TextBox1.Text = Application.AutoCorrect.CorrectSentenceCap = True

This appears to only turn on the AutoCorrect.CorrectSentenceCap
property according to the MS help file. Other then that, I don't
know!

Any other ideas?

-Minitman



On Sun, 6 Jul 2008 20:17:11 -0400, "Gary Keramidas"
<GKeramidasATmsn.com wrote:

this will do the same thing,
With Range("A1")
.Value = UCase(Left(.Value, 1)) & Mid(LCase(.Value), 2,
Len(.Value))
End With

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
this may do what you want

Sub test()
With Range("A1")
.Value = LCase(.Value)
.Value = UCase(Left(.Value, 1)) & Mid(.Value, 2, Len(.Value))
End With
End Sub


--


Gary


"Minitman" wrote in message
...
Greetings,

How Do I use "Application.AutoCorrect.CorrectSentenceCap". I can't
seem to get it to work!

Or is there a different way to get the contents of a TextBox to
convert to correct sentence structure with the first letter of each
sentence to be capitalized and the rest lower case?

Any help will be appreciated.

-Minitman








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sentence Capitalizatio

The following code should do what you want. Note that only the period,
exclamation point and question mark are assumed to be end of sentences; if
you want other symbols to mark the end of a sentence, you will have to add
the appropriate Replace function calls (follow the structure I used for the
other symbols if you have to do this).

Dim X As Long
Dim TBoxText As String
Dim Lines() As String
TBoxText = TextBox1.Text
TBoxText = Replace(Replace(TBoxText, "? ", "?."), "! ", "!.")
TBoxText = Replace(Replace(TBoxText, ". ", "."), vbLf, vbLf & ".")
Lines = Split(TBoxText, ".")
For X = 0 To UBound(Lines)
Lines(X) = UCase(Left(Lines(X), 1)) & Mid(LCase(Lines(X)), 2)
Next
TBoxText = Join(Lines, ".")
TBoxText = Replace(Replace(TBoxText, "?.", "? "), "!.", "! ")
TBoxText = Replace(Replace(TBoxText, ".", ". "), vbLf & ".", vbLf)
TextBox1.Text = TBoxText

Rick


"Minitman" wrote in message
...
Hey Gary,

Thanks for the reply.

If I understand your code, it is forcing the format of cell A1 into
the 1st character being uppercase, and everything else to be
lowercase, is that correct?

I think a better description of my problem is in order

First, these TextBoxes are on a UserForm, not a sheet.
Second, the TextBoxes are being used as memo fields. There could be
many sentences in 1 TextBox not just one.

I was given code snippet as a possible solution awhile back, but I
didn't check it out:

TextBox1.Text = Application.AutoCorrect.CorrectSentenceCap = True

This appears to only turn on the AutoCorrect.CorrectSentenceCap
property according to the MS help file. Other then that, I don't
know!

Any other ideas?

-Minitman



On Sun, 6 Jul 2008 20:17:11 -0400, "Gary Keramidas"
<GKeramidasATmsn.com wrote:

this will do the same thing,
With Range("A1")
.Value = UCase(Left(.Value, 1)) & Mid(LCase(.Value), 2,
Len(.Value))
End With

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
this may do what you want

Sub test()
With Range("A1")
.Value = LCase(.Value)
.Value = UCase(Left(.Value, 1)) & Mid(.Value, 2, Len(.Value))
End With
End Sub


--


Gary


"Minitman" wrote in message
...
Greetings,

How Do I use "Application.AutoCorrect.CorrectSentenceCap". I can't
seem to get it to work!

Or is there a different way to get the contents of a TextBox to
convert to correct sentence structure with the first letter of each
sentence to be capitalized and the rest lower case?

Any help will be appreciated.

-Minitman





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Sentence Capitalizatio

Hey Gary,

Thank you for finding that thread! I had forgotten about it and I
haven't been on that site in a while. I was having trouble with my
subject names.

And yes, Dave's solution did finally work, once we got the number of
spaces after the punctuation settled. I still don't understand
Jindon's solution, though.



On Mon, 7 Jul 2008 00:50:18 -0400, "Gary Keramidas"
<GKeramidasATmsn.com wrote:

somebody posted an answer last year for you. did it work?

http://www.ozgrid.com/forum/showthread.php?t=77385


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Sentence Capitalizatio

Hey Rick,

Thanks for the reply.

I tried your code, but could not get it to work properly.

Gary's reminder of my old post on Ozgrid last year did contain an
answer that works, I had forgotten about it.

I think this problem is solved.

Thanks everyone.

-Minitman


On Mon, 7 Jul 2008 04:30:32 -0400, "Rick Rothstein \(MVP - VB\)"
wrote:

The following code should do what you want. Note that only the period,
exclamation point and question mark are assumed to be end of sentences; if
you want other symbols to mark the end of a sentence, you will have to add
the appropriate Replace function calls (follow the structure I used for the
other symbols if you have to do this).

Dim X As Long
Dim TBoxText As String
Dim Lines() As String
TBoxText = TextBox1.Text
TBoxText = Replace(Replace(TBoxText, "? ", "?."), "! ", "!.")
TBoxText = Replace(Replace(TBoxText, ". ", "."), vbLf, vbLf & ".")
Lines = Split(TBoxText, ".")
For X = 0 To UBound(Lines)
Lines(X) = UCase(Left(Lines(X), 1)) & Mid(LCase(Lines(X)), 2)
Next
TBoxText = Join(Lines, ".")
TBoxText = Replace(Replace(TBoxText, "?.", "? "), "!.", "! ")
TBoxText = Replace(Replace(TBoxText, ".", ". "), vbLf & ".", vbLf)
TextBox1.Text = TBoxText

Rick


"Minitman" wrote in message
.. .
Hey Gary,

Thanks for the reply.

If I understand your code, it is forcing the format of cell A1 into
the 1st character being uppercase, and everything else to be
lowercase, is that correct?

I think a better description of my problem is in order

First, these TextBoxes are on a UserForm, not a sheet.
Second, the TextBoxes are being used as memo fields. There could be
many sentences in 1 TextBox not just one.

I was given code snippet as a possible solution awhile back, but I
didn't check it out:

TextBox1.Text = Application.AutoCorrect.CorrectSentenceCap = True

This appears to only turn on the AutoCorrect.CorrectSentenceCap
property according to the MS help file. Other then that, I don't
know!

Any other ideas?

-Minitman



On Sun, 6 Jul 2008 20:17:11 -0400, "Gary Keramidas"
<GKeramidasATmsn.com wrote:

this will do the same thing,
With Range("A1")
.Value = UCase(Left(.Value, 1)) & Mid(LCase(.Value), 2,
Len(.Value))
End With

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
this may do what you want

Sub test()
With Range("A1")
.Value = LCase(.Value)
.Value = UCase(Left(.Value, 1)) & Mid(.Value, 2, Len(.Value))
End With
End Sub


--


Gary


"Minitman" wrote in message
...
Greetings,

How Do I use "Application.AutoCorrect.CorrectSentenceCap". I can't
seem to get it to work!

Or is there a different way to get the contents of a TextBox to
convert to correct sentence structure with the first letter of each
sentence to be capitalized and the rest lower case?

Any help will be appreciated.

-Minitman





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
Formulas in a sentence.... krissy Excel Discussion (Misc queries) 2 February 25th 10 12:00 PM
Using a formula in a sentence krissy Excel Discussion (Misc queries) 5 February 25th 10 04:55 AM
Need help triming a sentence Jim Excel Discussion (Misc queries) 8 November 25th 09 10:48 PM
Sentence Case Alex Excel Discussion (Misc queries) 2 August 21st 08 09:45 PM
Two different colors in one sentence Jenn New Users to Excel 2 November 17th 05 07:14 PM


All times are GMT +1. The time now is 11:19 AM.

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"