I have this string which contains a hyphen "-". If i run the following code such that my temp_string has a "-" in it ........code will run fine. However, if i remove the "-" from the temp_string then the code has a run time error of "Invalid procedure call or argument".
I know that the reason i get this run time error is that i am looking for a hyphen in a string that has no hyphen ...........not sure what to do. Need some way of making program not "stop" ......not sure.
'temp_string = "Denosumab - Bone Loss Oncology"
temp_string = "Denosumab"
junk1 = InStr(1, temp_string, "-", 1) - 1
junk2 = Left(temp_string, junk1)
junk3 = Trim(junk2)
MsgBox (junk1)
MsgBox (junk2)
MsgBox (junk3)
Bookmarks