Excel VBA Macro: User Defined Type Not Defined

Your error is caused by these: These types, Table and Row are not variable types native to Excel. You can resolve this in one of two ways: I have not tested your code but I suspect ActiveDocument won’t work in Excel with method #2, unless you properly scope it to an instance of a Word.Application object. I don’t see that anywhere … Read more

VBA, if a string contains a certain letter

Try using the InStr function which returns the index in the string at which the character was found. If InStr returns 0, the string was not found. InStr MSDN Website For the error on the line assigning to newStr, convert oldStr.IndexOf to that InStr function also.