Before replace:
variable(i).caption
variable(u).caption
etc...
After replace:
variable(i).value
variable(u).value
etc...
With "variable(*).caption" in the Find filed I find them all, but
"variable(*).value" in the relpace fild gives this result:
variable(*).value
variable(*).value
etc...
Is there a way to acheive what I want?
Can I do this on the .frm file like if they where regular files using
an advanced find/replace tool without corrupting the frm files.
:-) S
For code you could put the following in a loop:
Sub ReplaceStrg()
Dim strg As String
strg = "Variable(x).Caption"
Mid$(strg, InStr(1, strg, ".") + 1, 7) = "Value "
Debug.Print Trim(strg)
End Sub
Not so sure if you just wanted to use the Find dialog. Would it be
possible just to do find/replace on the ".caption"??
Hope that helps.
Andrew
Passed
variable(i).Caption
variable(u).Caption
Result
variable(i).Value
variable(u).Value
If the strings to be changed literally have the indices "i" and
"u", then you're set. To answer your other question : In your specific
case, you can just open the files in a text editor and do the
replacement there. (If you were to replace the word "begin" with
another word, for instance, you would have problems!)
Just an FYI/helpful hint, if you want to open *any* file in notepad
from Explorer's context menu, just add the following registry keys :
HKEY_CLASSES_ROOT\*\shell\EWN\(Default)="Edit with notepad"
HKEY_CLASSES_ROOT\*\shell\EWN\command\(Default)="notepad.exe" "%1"
Although this should go without saying, be extremely careful when
editing the registry, and if you're in doubt, don't do it. :)
HTH,
J.
I'll try a text editor that is a littel more capable then, using
regular expressions. Should work for me. Thanks for the info in regular
expressions by the way, haven't yet tried the examlpe but it should
lead me on the right path.
:-) Mats
This does it in Word:
Find box: variable(*).Caption
Relpace box: variable\1.Caption
Mark "Use wildcards" option
Haven't run it on the actual VB .frm files yet, but I suppose you have
to be careful with Word to treat it as plain text file not to get
strange control charachters in the file.
(Just to make sure, I tried the above in the VB IDE. The search work,
but not the replace, at least not in my (pretty old) version.)
:-) Mats
That seems to be the case... the "Use Pattern Matching" option
appears to use the pattern on searches only. If you click the Help
button on the Replace dialog box, this is what it says about this
option...
"Searches using pattern-matching characters."
Note, it only says "searches"; no mention is made about
replacements. I guess Microsoft did not place a true Regular
Expression engine behind this option. Too bad, it would have been
nice (and one would think not too difficult either).
Rick