ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Repeating text in a text box within Excel. (https://www.excelbanter.com/excel-discussion-misc-queries/2749-repeating-text-text-box-within-excel.html)

fsattar

Repeating text in a text box within Excel.
 
I write reports quite frequently and a lot of the sentences that I write are
reprtitive. Therefore I am looking a way to optimize my time by automating
these sentences. A minor complication to this entire scenario is that my text
is in a text box.
I could use some help on this. Please.
Thank you

Debra Dalgleish

You can use AutoCorrect to replace a typed code with a sentence. For
example:

Choose ToolsAutoCorrect Options
In the Replace box, type a code, e.g. cs1
(the code will represent Comment Sentence 1)
In the With box, type the first sentence
Click the Add button, and enter codes and text for the remaining sentences.
Click OK

In a comment, type a code, then press the space bar, or type a
punctuation character. The code will be replaced by the text.
(The AutoCorrect entries will also work on the worksheet, and in other
Office applications.)

fsattar wrote:
I write reports quite frequently and a lot of the sentences that I write are
reprtitive. Therefore I am looking a way to optimize my time by automating
these sentences. A minor complication to this entire scenario is that my text
is in a text box.
I could use some help on this. Please.
Thank you



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


Harald Staff

Hi

Assuming a Control toolbox textbox, if so it's no complication, but rather
"the way to do it".

Make its Keydown code look like this (in the worksheet module for a box on a
worksheet, in the userform module for a box on a userform):

Private Sub TextBox1_KeyDown(ByVal KeyCode _
As MSForms.ReturnInteger, _
ByVal Shift As Integer)
If Shift = 2 Then 'Ctrl
Select Case KeyCode
Case 49 ' Ctrl 1
KeyCode = 0
TextBox1.SelText = _
"Harald says Hi!"
Case 50 'Ctrl 2
KeyCode = 0
TextBox1.SelText = _
"Harald says You're fired!"
Case Else
End Select
End If
End Sub

Now hold Ctrl while typing 1 or 2 into it and text is entered.
HTH. Best wishes Harald

"fsattar" skrev i melding
...
I write reports quite frequently and a lot of the sentences that I write

are
reprtitive. Therefore I am looking a way to optimize my time by automating
these sentences. A minor complication to this entire scenario is that my

text
is in a text box.
I could use some help on this. Please.
Thank you




fsattar

Thank you for your help.

"Debra Dalgleish" wrote:

You can use AutoCorrect to replace a typed code with a sentence. For
example:

Choose ToolsAutoCorrect Options
In the Replace box, type a code, e.g. cs1
(the code will represent Comment Sentence 1)
In the With box, type the first sentence
Click the Add button, and enter codes and text for the remaining sentences.
Click OK

In a comment, type a code, then press the space bar, or type a
punctuation character. The code will be replaced by the text.
(The AutoCorrect entries will also work on the worksheet, and in other
Office applications.)

fsattar wrote:
I write reports quite frequently and a lot of the sentences that I write are
reprtitive. Therefore I am looking a way to optimize my time by automating
these sentences. A minor complication to this entire scenario is that my text
is in a text box.
I could use some help on this. Please.
Thank you



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html




All times are GMT +1. The time now is 06:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com