I go through an MSWord document and try to draw all paragraphs with style, "question" and then Repeat them at the end of the document. Any suggestion would be super helpful - what I have here (I think all the steps are here because I'm having trouble with VBA formatting).
The sub-bridge question () is a new line at the end of the '' pull quest macro '' document curpled on every curPar in ActiveDocument. .ListParagraphs.Count 'publication', then curPar.Selection.Style = "question", then Selection.TypeText (curPar & VbCr) if the end subs >>
I think you might find the search function for you to find the more efficient following code document and the values in an array Put not and then put them in the end of the document. This paragraph style will also be set to reflect the original. Keep in mind that if you continue with the styles applied to the output at the end of the document, you will get a bad output.
I have commented it quite well but let me know what to understand 'to understand it.
sub searchstyles () dim as iCount integer, iArrayCount as integer, bFound as a boolean 'We will store our result in an array so that it set (consider 50 entries) ) Redeem = wdStory 'set your search parameters and look for the first example with: sArray (1 to iArrayCount) string as iArrayCount = 50' state your style type sMyStyle = "Title 1" 'Always Document Selection.HomeKey Selection.Find starting at the top of the unit .ClearFormatting .text = "". Replacement.T Ext = "" .ward = true .rap = wdFindContinue .format = false .MatchCase = false .MatchWholeWord = false .MatchKashida = false .MatchDiacritics = false .MatchAlefHamza = false. MatchControl = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchFuzzy = False .MatchWildcards = True .Style = sMySt Yale. 'If we meet one we can set a loop to check' I have always kept a look for a reason to avoid the interval loop or do not do during any other choice. Find.Found = True and iCount & lt; 1000 iCount = iCount + 1 'If we have any results, then add the text to the array if selection is selected. Find.Found then bFound = True 'we do a check on the array and resize the size if necessary (more efficient than resizing every loop ii mod iArrayCount = 0 then save ReDim sArray sArray (iCount) = Selection .text 'Find Selection.Find.Execute End Reset LOOP if the' real size 'array to save the final form reDim sArray (1 UBound (sArray) + to iArrayCount) (1 to iCount) if the bFound' document again ActiveDocument.Bookmarks ("\ EndOfDoc"). For Range.Select Selection.TypeParagraph ii = LBound (sArray) for UBound (sArray) Selection.Text = s Output to Array (ii) Selection.Range.Style = sMyStyle Selection.MoveRight wdCharacter, 1 then ii & lt; UBound (sArray) then Selection.TypeParagraph Next ii end then End Sub
No comments:
Post a Comment