Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding strings in an Excel spreadsheet

Status
Not open for further replies.

nichols

Technical User
May 24, 2001
92
GB
You'll have to excuse my terminology here as I am a vbscript novice. I want create a script in a Excel 2000 document which will have a text box, allowing the user to enter a string i.e. Statement Recs and On doing so the vbscript will look at 3 columns within the same worksheet, i.e Cell E6 accross to I6, with each row going down to row 15 i.e E15 accross to I15 . Each cell will have a string i.e. Statement Recs. If the text that is typed in the text box matches any of the text in one of the columns then I want it to run the following script:

strSoundFile = "G:\IT\family fortunes\familyfortunes.wav"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "sndrec32 /play /close " & Chr(34) & strSoundFile & Chr(34)
objShell.Run strCommand, 0, True



And also format that particular cell so that the text string changes colour to yellow.


If the string in the textbox i.e. Statement Recs, is not found in any of the cells then I want the following vbscript to run:


strSoundFile = "G:\IT\family fortunes\familyfortunes1.wav"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "sndrec32 /play /close " & Chr(34) & strSoundFile & Chr(34)
objShell.Run strCommand, 0, True


I have managed to get this far but I don't know how to do the above. Any help would be greatly appreciated.
 
What is your actual code and where are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I don't have any code yet I am starting from scratch. I just need pointing in the right direction i.e how can I get the script to search a range of cells against a string in a text box. Then how do I make it play the .wav file and then either change the font colour on the correct match to yellow or change an X at the end of the row to red and play the other .wav file. Maybe this is not possible but I want to give it a go if it is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top