I haven't coded in Visual Basic in about 5 years, but I need to make an excel macro to send out emails at work. After searching through some string methods and the likes, I was able to put this together. I looks like it should work, but I'm not sure why I'm getting a compile error of "invalid qualifier" on this line:
index = fullName.IndexOf(" ")
It points to fullName
Also, the code is taking a list of names from an excel sheet and sending emails. However, the names are in the format "Doe, John" and I'm swapping it to John Doe for when we send the email. Most of the code is missing, however this is the code to do with the problem at hand.
dim fullName as String dim firstName as String dim lastName as String dim indexNum as Integer dim last as Integer fullName = Cells(cell.Row, "A").value last = Len(fullName) index = fullName.IndexOf(" ") firstName = fullName.Substring(0, indexNum) lastName = fullName.Substring(indexNum, last)