Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. chunks = Round(Len(replace) / 250, 0)
  2. If Len(replace) Mod 250 > 0 Then chunks = chunks + 1
  3. If chunks = 1 Then
  4. .Execute FindText:=search, ReplaceWith:=replace, replace:=wdReplaceAll
  5. Else
  6.  
  7. .Execute FindText:=search, ReplaceWith:="{1}", replace:=wdReplaceAll
  8.  
  9. ' Replace the text in chunks of less than 255 characters
  10. For i = 1 To chunks
  11.  
  12.  
  13. chunk = Mid(replace, ((i - 1) * 250) + 1, 250)
  14.  
  15.  
  16. If i < chunks Then chunk = chunk & "{" & (i + 1) & "}"
  17.  
  18. .Execute FindText:="{" & i & "}", ReplaceWith:=chunk, replace:=wdReplaceAll
  19. Next i
  20.  
  21. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement