Tech Support Guy banner
Status
Not open for further replies.
1 - 5 of 5 Posts

· Registered
Joined
·
4,936 Posts
Discussion Starter · #1 ·
OK, I'm stumped. I'm using VBA in a program called Reflection by IBM to create and close my service center tickets. I'm trying to use the Left function in VBA to get the first three character of a customer's fax number but I am getting an error "Wrong Number of Arguments or Invalid Property Assignment"

Everything works fine when I use the MID and RIGHT functions....I'm only getting this error with the LEFT function :confused: I've used this function a million times and never had a problem. I'm positive that the syntax and format of my LEFT statement is fine. Does anyone have a clue what is going on?

Rollin
 

· Registered
Joined
·
4,936 Posts
Discussion Starter · #3 ·
MID and RIGHT both work fine. The VBA Intellisense pops up whenever I type either of these two functions and tap the spacebar. The LEFT function however is not recognized by Intellisense and is causing the error mentioned above. I'm about to explode...I just can't make any sense of this.

vTelephone = "4044521212111"

vAreaCode = left(vTelephone , 3) --> Error Here Can't Compile Code without deleting

vPhone = Mid(vTelephone, 4, 7) ---> No Error

vExtension = Right(vTelephone, 3) ---> No Error



Rollin
 

· Registered
Joined
·
4,936 Posts
Discussion Starter · #4 ·
Andy,

Your suggestion works but I am just stumped as to why this is happening? If you are like me, you don't rest until your find out what is causing such a silly unexplainable error. I actually worked around the problem by declaring a string variable that is 3 characters in length and setting it equal to the phone number variable. Here is an example

Code:
Dim vShort As String * 4
Dim vLong As String

vLong = "This is a Test"

vShort = vLong

MsgBox (vShort)
Rollin
 

· Registered
Joined
·
4,936 Posts
Discussion Starter · #5 ·
OK, I think I got this figured out. One of the other Library references in my project may also be using a function called "LEFT." To overcome this, I made an explicit call to the VBA library before calling my function and the Intellisense picked up on the function correctly. Just thought I'd let you guys know in case you ever run into this problem.

vAreaCode = VBA.Left(vTelephone, 3)

Rollin
 
1 - 5 of 5 Posts
Status
Not open for further replies.
Top