Re: Search and 'Replace' parameter too long?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Greg (gmaxey_at_mvps.org)
Date: 02/03/05


Date: 3 Feb 2005 13:10:02 -0800

Helmut,

Your solution is very clever. While Dave's method of using the
clipboard works for Replace, I don't know how, or if, you could use the
clipboard for both search and replace strings longer than 254
characters.

I have since realized that the input box in not suitable for defining
the long string (> 254 characters). I have since altered my version to
get the strings from a separate document:

Dim oSourceDoc As Document

Set oSourceDoc = Documents.Open(FileName:="C:\Test.doc")
txtFind = oSourceDoc.Paragraphs(1).Range.Text
txtReplace = oSourceDoc.Paragraphs(2).Range.Text
oSourceDoc.Close

WRT the Boolean return value. I am not very familiar with passing
information between routines. It seems like I should be able to
control the loop without the added value Esc. Something like

Do
  sF = txtFind
  sR = txtReplace
  ReplaceLong(sF, sR)
Loop While ReplaceLong = True

but that doesn't work.

Profunde Cogitate
Greg



Relevant Pages

  • Re: Find Dialogue Box
    ... It threw me into a "loop of death". ... of whatever it was looking for (which wasn't what was on the clipboard, ... >> When I double click the REC macro button and then paste the selected word ... >> I think what I need is a variable, MyString As String ...
    (microsoft.public.word.vba.beginners)
  • RE: Copying worksheet error
    ... i have learned not to use the copy command in a loop. ... usually crashes the macro with memory error messages. ... this will clear your clipboard just before the copy and may solve your ... > I have made a macro that copies worksheets from diffrent workbooks, ...
    (microsoft.public.excel.programming)
  • RE: Copying cell text to clipboard (using Putinclipboard)
    ... to the clipboard in order for them to work with it elsewhere. ... The problem occurs if the cell content is quite long. ... strings ranging in length from 20 to 2090 characters. ...
    (microsoft.public.excel.programming)
  • Re: Generate Label names
    ... ....or write a helper app that creates the source code in a loop ... and puts it into clipboard. ...
    (microsoft.public.dotnet.languages.vb)
  • ClipboardUtils - easily copy text and images (also combined as rtf)
    ... I created a ClipboardUtils class which makes it easy to copy Strings ... It can also copy a graphical image of any JComponent to the clipboard. ... I also wondered how I could copy text AND images to the clipboard at ... I realised that one way to do it, is to create a rtf ...
    (comp.lang.java)