How do I change text within a paragraph in VB-script?

I am having some problems with changing the text inside a paragraph without affecting the styling of other paragraphs. It may be that I am using a wrong approach to changing existing text, I don't really know.
As an example, I have the following two paragraphs inside a table cell:
12
35
These two paragraphs have different paragraph styles applied to them.
If I now change the contents of the first paragraph to a 1 digit number, the style of the second paragraph changes to the same style as the first one.
Paragraph1.Contents = "4" & Chr(13)
The text is correct after the change, but the styling on the second paragraph is wrong:
4
35
I have also tried using Paragraph.Lines(1).Contents and Paragraph.Texts(1).Contents, but the result is the same.
Is there any way of changing text inside a paragraph, which ensures that noting other than that text is affected?

Hi Frank,
The problem is occurring because you're effectively removing the paragraph end by replacing the entire contents of the paragreaph. You want to use the Characters collection and the ItemByRange method so that you can leave the paragraph end untouched.
I'm pretty sure it would look something like this though I haven't tested this:
Set SChar = Paragraph1.Characters(1)
Set EChar = Paragraph1.Characters(-2)     'giving you the 2nd to last character.
Set TxtToDel = Paragraph1.Characters.ItemByRange(SChar, EChar).
TxtToDel.Delete
Then you can set Paragraph1.InsertionPoints(1).Contents to the new text.
If the ItemByRange doesn't work you can always loop through the character collectoin and delete all but the last characters in the paragraph.
Good luck!

Similar Messages

  • Changing text within frames without adding space at bottom

    Anyone know if there's a method for changing text within frames so that the successive text automatically flows into position without creating blank space at bottom of that current or a subsequent frame?

    Peter,
    You can combine the discussions if you want.  I actually deleted a sentence beginning the second discussion explaining that it was related to the first.  I thought it might impede the discussion.
    Let me describe my problem more completely.  I'm adjusting a book that was carefully crafted using frames for each page so that the text extended to the bottom of each page (frame).  This often splits text within a paragraph between two pages.  This was done so that the customer doesn't feel they are purchasing any blank space and for the aesthetic purpose of filling each page with text.  The only exception is the beginning of new chapters or sections.
    The problem is that I want to change a word here and there in preexisting paragraphs.  When I do, space often one-third the page length is generated at the bottom of a page (frame).  To fill that space and extend text to the bottom of the page again requires -given my current understanding of options- selecting the paragraph (beginning on one page and completed on the second) that has become interrupted by the blank space and performing a "keep lines together" option.  Unfortunately, this usually generates new blank space on a subsequent page, requiring a new "keep lines together"; in a seemingly unending regress of this procedure.
    What I require is a method enabling me to add text within a paragraph that will avoid the generation of the blank space by flowing the subsequent text (composing one or more paragraphs and splitting a paragraph between pages if required) to the end of the page; completely filling the page without requiring any use of "keep options" or whatever.
    Richard

  • How do I change Text Colour in a Spreadsheet?  The Help menu doesn't help.

    Simple question whcih i cannot find the simple answer to:  How do I change Text Colour in a Spreadsheet?  The Help menu doesn't help.

    Hi Lecia,
    You have several choices.
    Use the first set of controls in the Format Bar. One of these is a Color well (red in the image). Select the cell(s) in which you want the text coloured, then click the well to open its Color palette, and choose your colour.
    Use the Text Inspector. Open the inspector, click the Text button (T), and use the tools there (similar to the set in the Format Bar).
    Press command-T to open the Fonts Window. This offers a few more options than are available in the Inspector or the Format bar.
    Regarding "Help": I'd recommend using the Numbers '09 User Guide, which you can download via the Help menu. Easier to search, and easier reading than the individual Help articles. search 'text color' to quickly get to instructions on applying colour to text.
    Regards,
    Barry

  • How do I change text size in a check box in CS3

    How do I change text size in a check box in CS3?

    While I've never done it myself for a checkbox, components
    have a textField property which is essentially the texfield inside
    the component. You probably need to apply a TextFormat to it to
    change the size.
    But if this involves the same problem you had yesterday,
    where you couldn't change the width of the checkbox, I doubt you'll
    have much luck changing the text size

  • How do I change text in a pdf file

    How do I change text and info on a pdf file?

    Using Acrobat XI Pro --
    Tools - Content Editing - Edit Text & Images tool.
    If the PDF page content is the image of text from a scanner use Acrobat's ClearScan to provide an OCR output that the tool can work on.
    Be well...

  • I am a computer novice, but how do I change text in a pdf file?

    I am a computer novice, but how do I change text in a pdf file that was sent to me?

    I would try Acrobat out, you can't do that in Adobe Reader.

  • How do you change text on a PDF file

    How do you change text on a PDF file

    If at all possible, you don't. You get the original (pre-PDF file), you edit that.
    Adobe Acrobat has some very limited facilities which sometimes allow very simple text edits to PDF (e.g. change a phone number).

  • How can I change text to a document?

    how can I change text to a document?

    Hi littleei54,
    I'm not sure that I follow. Would you like to edit text in a PDF (that requires Acrobat)? Or, do you want to convert a text file to PDF? Please provide a little more information and we will get you pointed in the right direction.
    Best,
    Sara

  • How to print the text in points wise in sap script

    hi friends,
    how to print the text in points wise in sap script.
    ex: if suppose paragraph consists of 15 lines. then according to one sentence or one fullstop (.) it should give point 1. like that...
    1. hai how ru.
    2. what r  u doing.
    3.where r u.
    like this i want numbering.. waiting for ur replys.
    thanks,
    kiran

    declare a counter
    data : cnt type char 4.
    print :
    cnt = cnt + 1.
    &cnt& &text&
    cnt = cnt + 1. and so on.
    or.
    if the data is in an internal table
    loop at internal_table.
    cnt = cnt + 1.
    write form.
    in script -&cnt& &text&
    endloop.
    Edited by: NIKHILKUMAR POOJARI on Nov 17, 2008 11:18 AM

  • How do I change text attributes within one text box in Motion 3?

    I am trying to change text attributes within one text box in Motion 3, but am only able to change the font/size for the entire box. Is there a way to change the attributes to individual lines of text within a text box without creating an entirely new one or using the "Lower Third" text effect?
    How do I create (two different) multiple colors, fonts, bold, italic, underline in one text box within Final Cut Studio Motion (FCP, FCS)

    Thank you! You saved me hours of tinkering around with multiple text boxes. It seemed like it should be something pretty elementary. It didn't help that I am not familiar with proper terminology, so thank you for defining glyph.
    Cheers,
    Owfownugi

  • How do I change text size in auto-page tabs

    Now I'm trying to make the page tabs fit across my page. I've got several pages and will probably have more. I don't want all of them on the bar as they'll be linked in my text. I would also like to make the text smaller and maybe reformat to another font or style.
    I don't find anything on this but maybe I'm not searching the right terminology.

    You're referring to the navbar.  You can remove any page from the navbar by going to the Inspector/Page/Page pane while viewing the page and unchecking the box to include that page in the navbar:
    To change the font size of the navbar text see this post by Cyclosaurus: How do you change the size and font of...: Apple Support Communities.
    Wyodor also posted a way to change the font size: Darkroom Navigation Font Size: Apple Support Communities.
    If you only have a couple of pages you can create your own text based navbar and complete control over the font, size, rollover color, etc. This demo page has an example: Text Based Navbar. Be sure to use Web Safe Fonts. 
    OT

  • How can i Change Text Color in table

    How can i change the text color i table, the true becoming GREEN, and the text in Fals becoming RED.
    Someone can help me to resolve this problem with a sample, because when i run the program all text becoming green in (TRUE) and than when i chang it to the (fals) all becoming Red.
    Attachments:
    Color.vi ‏38 KB

    Modifying the properties of a control in a subVI do not modify the properties of a different control in the main VI. The data is the only thing passed back from the subVI. To modify the properties of the table in the main, you need to pass a reference to it to the subVI and modify it's properties. I've attached a modified llb that does what you want.
    Attachments:
    Main_color_Table_mod.llb ‏41 KB

  • How do I change text in a .pdf?

    My friend gave me a .pdf file that was already flattened but how do I change the text on it?
    Thanks for all your help,
    -Yzboy111

    kensavilleart wrote:
    Hi Yzzi
    Select square selection tool (top left hand corner tools palette)
    Select the text to change
    Delete
    Control d
    Choose Type tool and insert new text. Taaa Dum.
    That works ok as long as the replacement text is the same length as the existing text.
    Bill has the right idea and advice. Remember that sentences won't reflow if they need to, you have to have the exact same font that you are editing on your system and many other little quirks.
    In other words, anything more than a very basic edit either may not work or may be more trouble than it's worth.

  • How do I rotate text within a table Pages 4.3?

    Does anyone know how to rotate text within a cell in a Pages 4.3 table?

    You would have to use a floating text box over the cell. Make sure text wrap is turned off.

  • How do I format text within a TextArea

    Hello,
    I would like to create a simple text editor that performs
    syntax highlighting. In order to do so, I would need the ability to
    set the style of individual pieces of text within a TextArea. Is
    this possible? Do I need to subclass the TextArea (or perhaps the
    Text control) to do this? Any pointers in the right direction would
    be appreciated. Thanks!

    The issues around formatting text in the Flash Player are
    numerous. There are several experts who have weighed in on this,
    including .
    Axel
    Jensen who has made available a modification of the
    RichTextEditor component. Additionally,
    Jesse Warden has several older
    articles in his blog on this issue. Finally, there is a
    commercially available Flash/Flex text editor developed by Igor
    (last name unknown to me), and found at:
    http://www.flashtexteditor.com/.
    Overall, the issue of accurately formatting text in
    Flash/Flex has been an exercise in frustration, especially when
    trying to implement htmlText and CSS. I am absolutely amazed that
    Adobe's documentation for this very important aspect of web
    development is either unavailable or deeply flawed, and on top of
    that: How is the Acrobat Connect Buzzword application able to do so
    much with text formatting, clearly within a Flex Framework, and yet
    no concrete documentation of the techniques are available

Maybe you are looking for

  • Enterprise Portal document preview issue

    Greetings, When viewing a document via the preview function provided by the context menu on the Enterprise Portal on a users laptop, the preview is too small. When I do the same thing on my desktop screen, the preview is adequate because I have a dif

  • Drag and drop with files

    hi! i know there is a drag and drop api in java but is is possible that i drop files in a window of my aplication? and how?

  • WHERE Clause sorting via String

    Hi, I am joining 2 tables together while using DISTINCT in the Select statement but i need to sort all the rows that only match by Date '1996'. Problem is the conversion of the Date/Time value is not a String i need to return only the rows where comp

  • Can you set a reflective gradient as background fill?

    I have my browser fill set to #e3e3e3 and I want to make the content area have a gradient background with a reflective gradient.  In other words, I want it to go from #e3e3e3 to white to #e3e3e3 again.  Is this possible without using an image?

  • Iphone update problem

    Both on my Windows computer (Vista Premium) (itunes 7.6 updated today) and my Mac (OS 10.4.11) (itunes also updated today), I have gotten the identical message on both machines while attempting to update from 1.1.3 to 1.1.4): "iTunes could not sync t