Replace Function help

viruzman

New Member
Joined
Apr 24, 2007
Messages
19
hi there i have a VBA macro, and i would need somethign that could search and replace with wildcards.



the code below is what i am using, the string a =ReplaceWord("a", "STR=""5689139532659432", will always be slightly diffrent so i need a way to search like
STR="*" OR STR="????????????????".

i have also tried a function caleld replaceword() but when i open the text file afterwards everything is gone exept for that staring


Dim a As String
Open userform1.TextBox1.Text For Binary As #1
a = Input(LOF(1), 1)
Close #1
a = ReplaceWord("a", "STR=""5689139532659432", "STR=""44442955623468956")
Open userform1.TextBox2.Text For Output As #1
Print #1, a;
Close #1
MsgBox "The File Was Successfully Searched", vbOKOnly
Unload Me
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,224,566
Messages
6,179,558
Members
452,928
Latest member
101blockchains

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top