crosweightloss.blogg.se

Word 2013 quick word replace
Word 2013 quick word replace










  1. WORD 2013 QUICK WORD REPLACE HOW TO
  2. WORD 2013 QUICK WORD REPLACE CODE
  3. WORD 2013 QUICK WORD REPLACE DOWNLOAD

Made by a loop through all paragraphs and a call not looping through each paragraph, directly passing the paragraph index that I obtained in a different method. I used Debug.Print to see which calls were Strangely I see no difference in the method calls.

WORD 2013 QUICK WORD REPLACE CODE

Using the code here - I can accurately select the headings that I want, but the text is not replaced with the new text when not looping through the paragrahps. Without changing the code (to the best of my knowledge) that behavior has changed. Paragraph that I wanted to change and then it worked. Up to recently I could simply pass the index of the It is a long time ago perhaps - but for some reason the code to replace a heading only seems to work when looping through each paragraph. I was hoping I might ask you another question about this topic.

WORD 2013 QUICK WORD REPLACE HOW TO

I tried adding vbNewLine,īut that does not produce the desired result.Īny suggestions how to keep the changed text from moving into the table? Text, the desired text is changed and the Heading 1 style is kept, but the text collapsed/moved into the upper left cell of the table that in the original situation sits directly below the "Heading 1" text. TypeText is executed, but the text is not changed. Text = "Example QP " & Count & vbNewLine UngroupCCs() ' I group the content controls after inserting a qp - so they need to be ungrouped before text van be changed.ĭim currentSelection As Word.Selection = Application.Selection Paragraphsĭim currentSelection As Word.Selection = ĭim FindObject As Word.Find = currentSelection.Find You could modify your code like below: Dim Count As Integer = 0

WORD 2013 QUICK WORD REPLACE DOWNLOAD

You can download an example file here.Īccording to your description, I have used your sample file to reproduce this issue. >I ran your code - and in my file the the "Heading 1"-style headings are correctly selected, but the text is not changed.

word 2013 quick word replace

'.Replacement.Style = style.NameLocal("Heading 1")Īny suggestions how to properly replace the text in the desired way would be greatly appreciated. TgtString = srcString.Trim & " " & count ' set the target stringĭim FindObject As Word.Find = If tmpString.Contains(testString) And (srcString.Trim).Length > testString.Length Then ' this condition should test the situation that a Quick Part is in the document,ĮlseIf srcString.Equals(testString) Then ' this condition should result in finding the "heading 1" with text "Example QP" without a numberĬount = count + 1 ' prepare the number to add to the textstring I wrote the following code, which (slowly) finds each "Heading 1" style, with the correct text, but I can't figure out how to replace the text:įor Each paragraph As Paragraph In .Paragraphsĭim tmpString As String = ĭim srcString As String = tmpString.Replace(vbCr, "").Replace(vbLf, "") ' I remove any formatting for the comparison to work

word 2013 quick word replace

If I insert the quickpart I want to add a number, i.e.:Īnd if I insert the same quickpart again, it should say That already exist with that heading in a document. What I want to achieve is to add a number to this heading, based on the number of quick parts Each Quick Part consists of a heading text with "Heading 1" style.

word 2013 quick word replace

I provide the user with Word Quick Parts.












Word 2013 quick word replace