![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I need a code that does the following:
1. copy and paste text from a sheet in a Microsoft excel book and paste it into the text box 2. Create a new paragraph at the end of every sentence, so each sentence starts on a new row (line) underneath the previous sentence. (each sentence will now start on its own line/row in the text box) 3. Select all text in the text box on each line 4. Add bullets to each sentence line. I recorded a macro below of the code. But I don't understand how to calculate the number of characters at the end of each sentence and then create a new line for each sentence underneath the previous sentence Please help: Range("N6:N12").Select Selection.Copy ActiveSheet.Shapes.Range(Array("TextBox 1")).Select Application.CutCopyMode = False Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters.Text = _ "I am from emmaus pa. I am from emmaus pa. I am from emmaus pa. I am from emmaus pa. I am from emmaus pa. I am from emmaus pa. I am from emmaus pa. " Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(1, 154).ParagraphFormat _ .FirstLineIndent = -13.5 With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(1, 21).Font .Bold = msoFalse .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Italic = msoFalse .Name = "+mn-lt" .UnderlineStyle = msoNoUnderline .Strike = msoNoStrike End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(22, 1).Font .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Name = "+mn-lt" End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(23, 21).Font .Bold = msoFalse .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Italic = msoFalse .Name = "+mn-lt" .UnderlineStyle = msoNoUnderline .Strike = msoNoStrike End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(44, 1).Font .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Name = "+mn-lt" End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(45, 21).Font .Bold = msoFalse .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Italic = msoFalse .Name = "+mn-lt" .UnderlineStyle = msoNoUnderline .Strike = msoNoStrike End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(66, 1).Font .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Name = "+mn-lt" End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(67, 21).Font .Bold = msoFalse .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Italic = msoFalse .Name = "+mn-lt" .UnderlineStyle = msoNoUnderline .Strike = msoNoStrike End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(88, 1).Font .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Name = "+mn-lt" End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(89, 21).Font .Bold = msoFalse .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Italic = msoFalse .Name = "+mn-lt" .UnderlineStyle = msoNoUnderline .Strike = msoNoStrike End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(110, 1).Font .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Name = "+mn-lt" End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(111, 21).Font .Bold = msoFalse .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Italic = msoFalse .Name = "+mn-lt" .UnderlineStyle = msoNoUnderline .Strike = msoNoStrike End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(132, 1).Font .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Name = "+mn-lt" End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(133, 21).Font .Bold = msoFalse .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Italic = msoFalse .Name = "+mn-lt" .UnderlineStyle = msoNoUnderline .Strike = msoNoStrike End With With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(154, 1).Font .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1 .Fill.ForeColor.TintAndShade = 0 .Fill.ForeColor.Brightness = 0 .Fill.Transparency = 0 .Fill.Solid .Size = 11 .Name = "+mn-lt" End With Range("G21").Select |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Macro to select an { includepicture } field code and format the picture behind text and 100% scale | sanpedro | Word VBA | 3 | 03-30-2015 10:50 PM |
| Microsoft Word macro to find text, select all text between brackets, and delete | helal1990 | Word VBA | 4 | 02-05-2015 03:52 PM |
VBA code for Microsoft Word macro — select text and insert footnote
|
ndnd | Word VBA | 10 | 01-06-2015 01:47 PM |
Outlook 2007 Code For Matching Textbox to a Combobox in a Different Form
|
lms | Outlook | 4 | 07-03-2013 08:34 AM |
| Excel 2007 - formula or macro/vba code required | wrighty50 | Excel Programming | 3 | 05-13-2012 02:24 PM |