![]() ![]() The part you now have needs thorough testing first. Consider this code a placeholder.įor your purposes code like this might do the job, perhaps.Paragraphs(1).Style = Head1 Actually, that is rather a different question, and I urge you not to rush for this result too fast. ![]() ![]() In my above sub there is just random code (extending the Rng by two preceding words and formatting everything as bold italics). This difference could be physical, like you didn't write the entire length of the text in the criteria, or technical, like excluding paragraph marks. But before you can do so you should deal with the difference between the text you found and the text you want to format. If the text was found you want to assign a style to it. If the text was found the found text (that is Rng.Text) is printed to the Immediate window, otherwise the original text Crits(i) with "didn't find". The second half of the sub deals with the outcome of the search. If the item is found you now have a handle on it by the name of Rng. But now the text is fed to the Find method which assigns the found text to the Rng range. The first half of the procedure will find each of the search criteria in your document using the same kind of loop as you already know from the test procedure. Execute FindText:=Crits(i), Forward:=True, _ It's just the infrastructure for testing and getting ready. Now you are ready to try to actually work on your document. Use the code below to test the above function. I shall add some practical concerns below. In theory it is enough if they are unique within the document. You can add as many elements as you wish. ' than the index because the latter starts at 0 ' observe that the actual number of elements is one greater ' the number of elements actually declared: ' The number of elements in the Dim statement must be equal to It might look like this:- Private Function SearchCriteria() As String()ĭim Fun(6) As String ' Fun = Designated Function return value To apply a heading style, select the text you want to format, then choose the desired heading in the Styles group on the Home tab. Create a separate function for this purpose. If you want to have more custom changes you can expand the “Define New Multilevel List” dialog box using More> button.If there is no way in which you can identify the heads you want automatically you may have to write everything once. This change is applied to all the numbered heading 1 titles in the document. Chapter) in the text box below “Enter formatting for number:”. ![]() You can navigate from heading to heading in.
0 Comments
Leave a Reply. |