Word range text


Word range text

Word range text. expression. "World". Document Dim i As Long For i = rng. // Define new application and open MS Word document. Find and Replace Only In Range. Text 属性返回该区域的无格式纯文本。 如果设置该属性,则将替换该区域中的现有文本。 示例. Range(Start:=0, End:=0) With rngFormat. Add Range:=myRange, NumRows:=3, NumColumns:=2. Runtime. Add(wdContentControlText, rng) With cc ' set what you need Example 2. ParagraphStyle '; " - "; DocPara. Type "Test" (without quotation marks) in the "Find what" field. Ok, Turns out you need to have a "clone" of the paragraph and then by setting the start and end of the range within the cloned variable you are able to set where in the paragraph you want to edit. To be included in the count, a cell must contain "apple" and only "apple". Duplicate. Range(wordrange2. also. The initial width of each column, in points. Paragraphs(1 In Aspose. Range("Hello World Hello", 6, 5) Output. Dec 21, 2023 · Sometimes a text value might repeat in a range more than once. However, see below for a case-sensitive option. See: InsertInBookmarkI and InsertInBookmarkII in the code pane below: Set oRng = ActiveDocument. Execute Then Debug. Support and feedback Aug 10, 2017 · To get the selected range of user selection : // Run a batch operation against the Word object model. Find. Jul 1, 2020 · how to add text to the end of a list item, not to a new line Hot Network Questions Closed form for the A110501 (unsigned Genocchi numbers (of first kind) of even index) This argument also controls what happens if there's a selection or range and the search text isn't found in the selection or range. Bold = 1; Nov 29, 2016 · Public Function FindLeft(ByVal rng As Range, ByVal char As Integer) As Range Dim doc As Document Set doc = rng. End Sub. Count). Jul 5, 2020 · The following works but there may be a more efficient way of doing this: Sub FindIt() Dim blnFound As Boolean. If myRange. Apr 27, 2015 · While trying to see if a particular cell had a certain length I was surprised to see that 2 extra characters were showing up in the cells. It then copies the third word (with formatting) to a Bookmark control. Add Set tableNew = docNew. Collapse Direction:=wdCollapseEnd. Text = ""; Also Thank you to varocarbas :) Returns a Characters collection that represents the characters in a range. Sub ExportExcelToWord() 'PURPOSE: Copy/Paste An Excel Table, Text, & Logo Image Into a New Word Document 'NOTE: Must have Word Object Library Active in Order to Run _. docx Oct 3, 2016 · 3. Text = "Dear " 另请参阅. wdCollapseEnd Set cc = rng. Delete the range of characters starting one from the end. This is what I have so far: Dim myRange As Object. Can be one of the following WdFindWrap constants:wdFindAsk After searching the selection or range, Microsoft Word displays a message asking whether to search the remainder of the document. docx": document. I am using this function in order to achieve it: Cells(insertRow, 1) = WorksheetFunction. This example is for a document-level customization. excelCol = 1. Sections(1) _. I've read info in help but cannot find any examples. I want to enter 3 blank lines to print Line2. Delete(); I've also tried range. Can be one of the WdFindWrap constants. Print "not Found" End If End With End Sub Share Improve this answer The COUNTIF function counts cells in a range that meet supplied criteria. This example selects the first paragraph in the active document. object end = 7; Dim rng As Word. If the document header is empty, StoryLength returns 1 for the final paragraph mark. Start, rng. Jan 27, 2014 · The following code will BOLD the sentence. End - 1) Set wordrange2 = Union(range1, range2) in Jun 3, 2012 · In reply to HansV MVP's post on June 4, 2012. NET 从 Word 文档中的多个范围中提取文本。 Jun 5, 2014 · Notice how there are very few modifications from the previous post's code. You see from the following image that the text “Apple” is repeating itself 3 times in the range B4:B14. ReplaceWith: Optional: Variant: The replacement text. Jul 2, 2016 · I want to search the range for the first occurrence of a word. wdFindContinue The find . In the example shown, the formula in cell H5 is: = COUNTIF ( data,"*") where data is the named range B5:B15. Jul 6, 2021 · To Group a selected range of text in Word, follow these steps: Launch Word. Documents. Path & "\Personality analysis and profile. Find the position of the last character of the bookmark. Usage. Click on the Developer tab. NewText = "Some Punter". RANGE definition: 1. 'Identify current Bookmark range and insert text. Dim aDoc As Document. Tables(1). This example uses SetRange to redefine myRange to refer to the area starting at the beginning of the document and ending at the end of the current selection. InlineShapes. myRange. How do you specify a range that includes only one word . Range(r - 1, r). Count) Sep 28, 2018 · This Word file has a giant table with 2 columns. Cell(Rw, 1). I can return the row number of that text in the range. Start a new instance of Word. Range Set rngCell = tbl. Jan 11, 2024 · Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Word. Text, as is the case whenever RegEx or, indeed, any function that manipulates strings is used, all formatting and other non-text characters are lost when a pure string is written back to the cell. Bookmarks ("StartBM"). This example replaces "Hello" with "Goodbye" in the active document. Applies to. Selection. For example, if a single character in your cell text were formatted as Bold, the bold formatting would be lost. Oct 14, 2015 · Sub importDocfile() Dim rng0 As Word. I am trying to get content from cells of a MS word document and copy it into an excel document with a macro using VBA. Remarks. TextEffect. ActiveDocument. End) r. This example creates a 3x3 table in a new document and inserts text into the first and last cells in the table. Sub SelectParagraph() ActiveDocument. Paragraphs(4). compareLocationWith to compare if the found range is the same and remove dupes. Optional. ContentControls. Bold = True End Sub See also. Tables. get Reviewed Text(change Tracking Version) Gets reviewed text based on ChangeTrackingVersion selection. Range Object. Support and feedback Mar 3, 2015 · 1. The following example inserts text at the end of the active document. Count, _ tableNew. Read/write String. Click the Group or Ungroup text The formatting will always apply to the current content of the Range. Text that is not visible could be, for example, text that is in a collapsed heading. Dim docNew As Document Dim tableNew As Table Set docNew = Documents. You can also use range. Range Dim WordApp As Object, WordDoc As Object Dim myRange As Word. how would you specify the range. doc Set WordDoc = WordApp. text) > 0 ' This should never fail but did. A Range in a Word document is a continuous sequence of text or a group of elements such as paragraphs, tables, and images. Dim rngCell as Word. When you set this property, the existing text in the range is replaced. Jun 17, 2015 · object start = doc. Dim bkmRng As Range. InsertBefore "Dear Sirs," End With See also. If you just want to set a header of the table, you can use Jan 18, 2022 · If the header story is not empty, a message box displays the contents of the header. wordrange2. End - 1 rng. I know that it's possible to combine Index and Match functions to find exact text within a range of cells. Case. Print Selection. The paragraphs in body of letter are to be justified while some paragraphs like subject line are to be center aligned. InsertParagraph . End = 15; cloneRange. Set rngFormat = ActiveDocument. This example fits the current selection into a space five centimeters wide. The character positions are used to create the range myRange. ReplaceBookmarkText (_Document doc, String bookmarkName, String text Aug 16, 2012 · 1. Paragraphs. Use the Range property to access the text, the formatting for the text, and other text properties. Wrap = wdFindContinue . Start = orng. docx"); // Select first paragraph. // Make Selected Text Bold. Range range = doc. ParagraphFormat. Start; //start of the second word object end = doc. Format = True 'we want to replace formatting of text as well . If Word cannot find a match Jan 18, 2022 · If this argument is omitted, Word sets the number of columns, based on the contents of the range. getSelection(); // Create a range proxy object for the current selection. Interop is more Complex but can be used for other file formats besides Docx. For more information, see Working with Range Sep 21, 2015 · I'm attempting it with: //Exception - CANNOT EDIT RANGE. A Range object that represents the portion of a document that is contained in the Bookmark control. Related formulas: Count cells with specific Jun 27, 2017 · End With. Application app = new Application(); Document doc = app. Set r = ActiveDocument. Content With myRange. Words(1) myRange. var range = context. The selecting of the range goes according to plan: Dim myCells As Range With ActiveDocument Sep 12, 2021 · This example copies the first paragraph in the active document and pastes it at the end of the document. expression Required. Text = captionStr & vbCr . Add(Selection. Range, 3, 3) With tableNew . Jun 3, 2012 · I'd like to copy a table like this in a word document and extract only the track titles and composers. Set BMRange = ActiveDocument. Range rngField = null; object oCollapseEnd = Word. Range With rngCell 'Go into the cell, rather than the entire cell . With . 'Debug. 展示如何获取范围覆盖的所有节点的文本内容。 Jan 18, 2022 · Returns a Range that represents the contents of the content control in the active document. Paragraphs(3). g. Sep 12, 2021 · The InsertParagraphAfter method inserts a new paragraph following a Range object. Selection. The following code example adds a Bookmark control with text to the first paragraph and then sets the text in the bookmark to bold. When you set this property, the text in the range is replaced with formatted text. Paragraphs(2). This example sets myRange equal to the first word in the active document. This example creates and sets the variable myRange to paragraphs two through four in the active document, and then it right-aligns the paragraphs in the range. " Selection. excelRow = 1. Mar 14, 2023 · The ISTEXT function checks if each cell in the specified range contains any text characters and returns an array of TRUE (cells with text) and FALSE (other cells) values. May 1, 2024 · You can use the Range method of a document object to create a Range object representing that document. Jan 25, 2017 · 0. but its. Aug 18, 2013 · Dim cc As Word. Here, I will use the SMALL, ROW, and IF functions to find text in range and return cell reference. I am trying to change text in a paragraph using vba word. May 3, 2023 · Close Word if running. Bold = 1; Hope this helps. Office VBA reference topic Apr 15, 2022 · I have the below code to insert lines in a word document. load(range); Sep 12, 2021 · Returns a Range object that represents the portion of a document that's contained in the specified object. See also Jul 8, 2022 · . Execute FindText:="blue", Forward:=True If you've gotten to the Find object from the Range object, the selection isn't changed when text matching the find criteria is found, but the Range object is redefined. wdCollapseEnd; object oMoveCharacter = Word. TablesOfFigures[i]. int WordTrue = 1; Jul 5, 2017 · a. Mar 2, 2015 · . How to code VBA to insert 3 blank lines in a word document so that I can print Line2 after th The following code example adds a Bookmark control with text to the first paragraph and then sets the text in the bookmark to bold. Every Range object is defined by a starting and an ending character position. So the idea is you grab a paragraph, analyze, find an issue, do a search to get the range (and make sure is the range you need). Text Apr 17, 2023 · The following example selects the next occurrence of the word "blue. Program. Oct 11, 2012 · Edit: I just tried saving the ParagraphFormat as a temp variable and then resetting the formatting with that, but the temp variable loses its formatting as well. Almost - but if you want to preserve the bookmarks for re-use, you could set the bookmarks one character short of the range and insert between the bookmarks e. The font size to use for the phonetic text. I've tried mixing using the Search function, but it doesn't seem to accept a range. Select Selection. Syntax. Range(start, end). ParagraphFormat = oldParagraphFormat; // oldParagraphFormat's objects are reset. Read/write Single. Feb 20, 2017 · Today I get a new Word 2016 version and I get this message: Unhandled Exception: System. It's a text with arbitrary formats with both bolded and normal characters. These new modifications will be explained below the following VBA macro code. Text Sep 12, 2021 · Returns an InlineShapes collection that represents all the InlineShape objects in a range. Enter text or use an existing document. expression A variable that represents a Bookmark object. ParagraphFormat; range. Cell(tableNew. Content. Support and Sep 12, 2021 · This argument also controls what happens if there is a selection or range and the search text is not found in the selection or range. Copy. Start, _. NET 从 Word 文档中的多个范围中提取文本吗? 答:是的,您可以使用 Aspose. Range 对象. 2. Support and feedback Jun 8, 2019 · When debugging your macros, you can use the Select method to ensure that a Range object is referring to the correct range of text. I have to make a statement like: If theCellIsEmpty, then Fill it End if The thing is that when I get the content of the cell through: FirstCellText = ActiveDocument. If you don't want to replace the existing text, use the Collapse method before using this property (see the first example). Mar 14, 2023 · Here's a generic Excel formula to count number of cells containing specific text: COUNTIF (range, " text ") The following example shows it in action. For the orignal question - this is just an intellisense bug, there is such property in the Range class. Delete. I am trying to find numbers at the start of a paragraph where the operator has selected the paragraphs to be searched. To count cells in a range that contain text values, you can use the COUNTIF function and the asterisk (*) wildcard. Tables(TableNo) 'copy cell contents from Word table cells to Excel cells. Bookmarks. For information about returning a single member of a collection, see Returning an object from a collection. Range = Me . Bold = 1; or. Range. The best way to insert text at a bookmark without losing the bookmark – which works reliably whether or not the bookmark currently encloses any text - is to set a range variable to the bookmark's range, as follows: Dim BMRange As Range. The Text property returns the plain, unformatted text of the selection or range. SetRange rng. Cell(2, 3). Dim orng As Range. 1. Case = wdUpperCase. Instead of this: Set searchRange = myRange. End; // start of the third word Word. Dim bkmName As String. Text Else Debug. I tried this code but its not working. So more like. Dim rng2 As Range. InsertAfter Text:="Title". The word "Title" is formatted with 24-point Arial font. In the new blank document, type "Test" (without the quotation marks). pos = ActiveDocument. document. oldParagraphFormat = range. Range(i, i + 1) ' Range is non-empty Debug. Power Query M. Paragraphs(8). Mar 29, 2022 · Use the InsertBefore method or the InsertAfter method of the Selection object or the Range object to insert text before or after a selection or range of text. Selects the specified range. run(function (context) {. Execute ("years ") Set range1 = wordobj. Example Jul 19, 1990 · I want to combine two ranges of a document and make it as another range. Read-only. Text=" Whatever"; replaces the ToF instead of prepending it with text. Assert Len(r. Text) But this only brings the text with spaces, without respecting the line jumps (carriage returns). Clean(. Words[2]. Replacement. In order to keep the bookmark you need to do: Dim bkm As Bookmark. Visible = True 'open the file . Start To rng. Click "More>Format>Font. . It's a bit messy but I've tried many different variations of ranges trying to get the text but it Mar 9, 2021 · Execute InsertAtBookmarkII above and review the result: Inserting text "in" a bookmark takes just a few extra lines of code but the results are well worth the effort. WdUnits Jan 18, 2022 · Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Cell (nRow, 2). Range(ref start, ref end); Since the number of words inside my word document is dynamic, the code above is not very helpful. InteropServices. To use this code example, run it from the ThisDocument class in your project. Start = 0; cloneRange. The following code example inserts text into the first paragraph and then formats the third word as bold. Tables(. expression A variable that represents a Range object. orng. WdCollapseDirection. Text = "" . a set of similar things: 2. ContentControl Dim rng As Word. Range Set rng = ActiveDocument. Characters. The Text property returns the plain, unformatted text of the range. I have used Union method. COMException (0x800A17EC): You can not edit the mark because it is protected. Text. Example. Open(@"D:\Test. Use search - you can scope it to the paragraph. End, wordobj. In the example shown, the formula in cell F5 is: =SUMIFS(C5:C16,B5:B16,"*hoodie*") This formula sums the quantity in column C when the text in column B contains "hoodie". get Text(options) May 28, 2014 · 0. InsertParagraphBefore(); int WordTrue = 1; Jan 18, 2022 · This example applies the Heading 1 style to the first paragraph in the active document. Sub ReadPara() Dim myString$. For example, to count the number of cells in a range that contain "apple" you can use COUNTIF like this: = COUNTIF ( range,"apple") // equal to "apple". Range; cloneRange. VB. For iRow = 1 To . Collapse direction:=Word. Note that SUMIFS is not case-sensitive. If this argument is omitted, Word calculates and adjusts the column width so that the table stretches from margin to margin. StoryLength > 1 Then MsgBox myRange. When you set this property, the text of the range or selection is replaced. Paragraphs(1). c#. Range myRange = doc. See also. Dim DocPara As Paragraph. Collapse wdCollapseEnd The Text property returns the plain, unformatted text of the selection or range. End). See also Jan 18, 2022 · Returns or sets the width (in the current measurement units) in which Microsoft Word fits the text in the current selection or range. InsertAutoText. Range ' Exclude the end of cell marker rng. Select. say you want to bold only the word electronically in the sentence or paragraph . Mar 2, 2017 · For example if I have "this text" and I change it to "that txt", txt will still be in bold. Instead of replacing text throughout the entire document, or in a selection, we can tell VBA to find and replace only in range. The following example locates the first occurrence Aug 1, 2018 · First "collapse" the Range to its end-point (think of it like pressing Right arrow for a selection). HomeKey wdStory. Optional Integer. For the problem from comments that. Paragraphs[1]. Range clonedRange = parag. The following code causes the Next to not go to the next element in the collection. You need to loop through the table rows and columns. End Set myRange = ActiveDocument. INT32. Duplicate; doc. Range(Start:=0, End:=Selection. Duplicate: By duplicating a Range object, you can change the starting or ending character position of the duplicate range without changing the original Jul 13, 2015 · r = ActiveDocument. This is what I got so far: get Range(range Location) Gets the whole paragraph, or the starting or ending point of the paragraph, as a range. End + 1. As follows: Word. wrdDoc. InsertAfter "First cell" . pos2 = ActiveDocument. Jan 18, 2022 · The TextVisibleOnScreen property returns 1 if all text in the range is visible; it returns 0 if no text in the range is visible; and it returns -1 if some text in the range is visible and some is not. Note that once you change the text, the bookmark will be removed from the Word Document. Sub Export_Table_Data_Word() 'Name of the existing Word document Const stWordDocument As String = "Table Report. SetRange Start:=myRange. Collapse wdCollapseStart 'other stuff . End - 1 Dim r As Range Set r = doc. Dim strTheText As String. Add the range to the document by passing a start and end character to the Range method of the Document class. End If. Format. Forward = True . How can I search a range for the first partial Jan 18, 2022 · Return value. End. Dim NewText As String. Paragraph oPara1; oPara1. set_Text (String prop) at msWordFiller. Once you have a range you can apply formatting, insert content Apr 28, 2022 · The first paragraph is center-aligned and one half-inch space is added after the paragraph. Set myRange = ActiveDocument. For more information, see Features available by Office application and project type. cell(iRow, iCol). Those characters appear to be ANSI codes 13 and 7 which correspond to Line Feed and Bell. Range(0, wordrange2. Range Dim strTheText As String Set WordApp = CreateObject("Word. Try this ( Untested) Dim excelRow As Long, excelCol As Long. Text (Word) Returns or sets the text in the specified range or selection. In below sample code the Heading 1 style will apply to first paragraph in "Test. BTW: Altough VB6 has the Clipboard object, VBA doesn't. Apr 10, 2018 · This example takes the range A1:A10 on Sheet 1 and exports it to the first table in an existing Word document named "Table Report". To collapse a range and insert new text. Set sText = Application. Interop. A variable that represents a Range object. Bookmarks[fieldName]. For information about returning a range from a document or returning a shape range from a collection of shapes, see the Range method. Jan 11, 2024 · To define a range in a document-level customization. Open(ThisWorkbook. at Microsoft. Application") 'word ll be close to run WordApp. Range(Start:=pos, End:=pos2) This example moves the starting position of myRange one character to the right (this reduces the size of the range by one Jan 21, 2022 · Attempts to match the text in the specified range or the text surrounding the range with an existing AutoText entry name. Aug 1, 2017 · 1. FitTextWidth. ActiveDocument. Range (Start:= 0, End := 7 ) rng. Format: Optional: Variant: True to have the find operation locate formatting in addition to, or instead of, the find text. For Each DocPara In ActiveDocument. Dim rngFound As Range. context. If no value is specified, Microsoft Word automatically sets the phonetic text at an optimum distance above the specified range. Range. Returns or sets a WdCharacterCase constant that represents the case of the text in the specified range. Office. Font. Explanation: Always declare your variables; Option Explicit will complain if you forget / misspell. Start) Set range2 = wordobj. Bookmarks ("MyBookmark"). If you have worked with Microsoft Word Automation, you probably know that one of the main tools to examine and modify document content is the Range object. Bookmarks("bmInBookmark"). The following example inserts text before the selection. Examples. Cell(1,1). This way your searchRange will be independent from myRange, as stated in the documentation on Range. Find . MyWordDoc. Text = "What " rng. Highlight the text. Range Object Apr 6, 2023 · expression 一个表示 Range 对象的变量。 备注. With interop either use: // Make Text Between Start And End Bold. End:=ActiveDocument. Application. MatchWildcards = True If . 本示例用“Dear”替换活动文档的第一个词。 Set myRange = ActiveDocument. Type this string in the second argument, and you will get this simple Jan 18, 2022 · This method determines whether the range returned by expression is contained in the specified Range by comparing the starting and ending character positions and the story type. Text. Nice approach anyway – The distance (in points) from the top of the text in the specified range to the top of the phonetic text. text = "" but I get the same result or "Range Cannot be Deleted". expression A variable that represents a ShapeRange object. For example, you can use a Range to format text, insert Dec 7, 2012 · 1. Sub InsertFormatText() Dim rngFormat As Range. In this example we defined the range as the first paragraph: Dim oRange As Range Set oRange = ActiveDocument. I'm looking for a way to change the whole text of the range, not just a single word, as I'm getting the new text from an independent API, I can assume that the new text and the old text have the same number of words. Open the Find dialog. Ranges are used to indicate the part of the document on which you want to apply a particular operation, such as inserting new content or manipulating existing content. Read/write. But I need to search for partial matches. Headers(wdHeaderFooterPrimary). " End Sub. Range(range. Check the bookmark exists. Notice this is an exact match. Cell. do this: Set searchRange = myRange. The code I am using to get the data is. For Each bkm In ActiveDocument. Word. InsertAfter 此代码使用以下方式访问文档的全部范围Range的财产Document类并使用以下方法检索该范围内包含的文本Text财产。 问:我可以使用 Aspose. For some reason the search finds the number (text) at the start of the next paragraph, even if the selection ends half-way through the first paragraph. Start, range. Words, a Range is a “flat window” into an otherwise tree-like model of the document. Applies to ShapeRange objects that represent WordArt. docx" 'Word objects. Sep 21, 2018 · Now you can apply custom style to any selection range. Range(0, 0) With myRange . InsertAfter Text:=" The end. Note: It doesn't use copy. You have to define a DataObject's text and put that object to the clipboard. We would like to show you a description here but the site won’t allow us. Print DocPara. To sum if cells contain specific text, you can use the SUMIFS or SUMIF function with a wildcard. Alignment = wdAlignParagraphCenter. ClearFormatting . Count. Columns. ScreenUpdating = False. Set oRng = Application. Range range=wordApp. Bold = True 'Move to the end of the range . Style = wdStyleHeading1. Jan 18, 2022 · In this article. Word. Jan 22, 2016 · When you work with Range. 支持和反馈 Apr 6, 2023 · expression は Range オブジェクトを表す変数です。 注釈. Start. Range是一个“外观”接口,提供将 document 或文档部分视为“平面”文本的方法,而不管 document 节点存储在树状对象模型中。 Range不包含任何文本或节点,它只是文档片段上的视图或“窗口” 。 例子. Rows. The double unary (--) or the multiplication operation coerces TRUE and FALSE into 1 and 0, respectively, producing an array of ones and zeros. Text = "new text"; range. Text プロパティは、範囲の文字列を書式設定されていない文字列を返します。 このプロパティを設定する場合は、範囲内の既存のテキストが置き換えられます。 Jan 18, 2022 · Dim r As Range. Set bkmRng = bkm. MyWordApp. Range is like a “window” into the document content and formatting. expression An expression that returns a ContentControl object. If Word finds a match, InsertAutoText inserts the AutoText entry to replace that text. Feb 26, 2015 · With "formatted Text" I didn't meant Rtf or Html Format. The result is 4 because four cells in the range B5:B15 contain text values. Learn more. InitialColumnWidth. Cell(5, 1). Provide product feedback. Variant. Range; range. get Reviewed Text(change Tracking Version String) Gets reviewed text based on ChangeTrackingVersion selection. Find the substring from the text "Hello World Hello" starting at index 6 spanning 5 characters. Supposing, you have a list of item IDs in A2:A10 and you want to count the number of cells with a particular id, say "AA-01". Tables(Tbl). This example inserts a new paragraph at the beginning of the active document. If myRange is not contained in the selected range, myRange is selected. Aug 18, 2015 · The Font size also is not exactly what I want, since it applies to the whole table and not only one cell. private void BookmarkFormattedText() {. Words(1) Jun 15, 2023 · Paragraph formatting is included in the Range object if there is a paragraph mark in the range or selection. the goods made by one company or goods of one particular type that…. Words for . this. Bookmarks("mark1"). Create a Range object that consists of the first paragraph in the document. Property value. Then move the starting point of the Range one character towards the end of the document - now it's outside the field. For example, the following selects a Range object that refers to the second and third paragraphs in the active document, and then formats the font of the selection. " Apply the "Bold" font attribute and click OK. The following example applies bold formatting to the first 10 characters in the active document. Set orng = ActiveDocument. Dim rng1 As Range. hy df ow nm ad up de jj ek nl