1 Replies - 1000 Views - Last Post: 26 September 2012 - 11:04 AM Rate Topic: -----

#1 CptFaulken  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 26-September 12

Invalid Qualifier Error When Using IndexOf?

Posted 26 September 2012 - 10:45 AM

Hello,

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)



Is This A Good Question/Topic? 0
  • +

Replies To: Invalid Qualifier Error When Using IndexOf?

#2 CptFaulken  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 26-September 12

Re: Invalid Qualifier Error When Using IndexOf?

Posted 26 September 2012 - 11:04 AM

Nevermind, I figured out why it isn't working. Don't know how to delete this thread though.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1