-
Jun 25th, 2008, 05:00 PM
#1
Thread Starter
New Member
VBA Invalid Qualifier on Strings
I'm working on a simple Macro for Excel, but I'm new to Visual Basic and I'm encountering some errors when working with strings. Here's an example of the error I keep running into:
Sub test()
Dim s1 As String
Dim s2 As String
s1 = "which case"
s2 = s1.ToUpper
End Sub
When I try to run this, I keep getting the error "Invalid Qualifier" highlighting s1.ToUpper
Thanks for any help!
-
Jun 25th, 2008, 05:08 PM
#2
Re: VBA Invalid Qualifier on Strings
So are you doing this coding within Excel? If so let me know because you may have posted in the wrong forum.
-
Jun 25th, 2008, 05:11 PM
#3
Thread Starter
New Member
Re: VBA Invalid Qualifier on Strings
I went in through Excel and am using the Visual Basic Editor under Macros. I then added a new module in the VB Editor which is where my code is located.
-
Jun 25th, 2008, 05:15 PM
#4
Re: VBA Invalid Qualifier on Strings
I'll assume that's a "yes" so I moved the thread to here.
-
Jun 25th, 2008, 06:37 PM
#5
Re: VBA Invalid Qualifier on Strings
Originally Posted by amzngspiderman29
I'm working on a simple Macro for Excel, but I'm new to Visual Basic and I'm encountering some errors when working with strings. Here's an example of the error I keep running into:
Code:
Sub test()
Dim s1 As String
Dim s2 As String
s1 = "which case"
s2 = s1.ToUpper
End Sub
When I try to run this, I keep getting the error "Invalid Qualifier" highlighting s1.ToUpper
Thanks for any help!
The code you wrote is for VB.NET? That does not work in VB6 or VBA.
Change it to:
Code:
Sub test()
Dim s1 As String
Dim s2 As String
s1 = "which case"
s2 = UCase(s1)
End Sub
-
Jun 25th, 2008, 08:01 PM
#6
Frenzied Member
Re: VBA Invalid Qualifier on Strings
However,if you write it in a formula in a cell, you would use Upper(A1), at least through XL 2K. And if you were writing VBA (macro) code, that is what you'd need.
Not sure if you're running XL as an application from another program.
No idea why the same versions of office would use UCase for some apps and Upper for others.
Tengo mas preguntas que contestas
-
Jun 25th, 2008, 08:32 PM
#7
Re: VBA Invalid Qualifier on Strings
Originally Posted by salvelinus
However,if you write it in a formula in a cell, you would use Upper(A1), at least through XL 2K. And if you were writing VBA (macro) code, that is what you'd need.
Not sure if you're running XL as an application from another program.
No idea why the same versions of office would use UCase for some apps and Upper for others.
The Sub Test() code is VB6/VBA code.
UCase() and LCase() are 2 of basic functions in VB6/VBA, they works wherever these languages are used.
UPPER() and LOWER() are 2 WorksheetFunctions that can be used on worksheet within formulas only.
The reason why VB uses UCase() and LCase() but worksheetfunction uses UPPER() and LOWER() is at the creation of Excel, MS intended to make the functions compatible with Lotus 1-2-3 functions.
-
May 5th, 2012, 11:17 AM
#8
New Member
Re: VBA Invalid Qualifier on Strings
SMonth = CBSMonth.ListIndex + 1
SYear = CBSYear.ListIndex + 1
when i try to run the program, they gave me the invalid qualifier msg box and highlights CBSMonth
can any1 help me please?
-
May 5th, 2012, 11:57 AM
#9
Re: VBA Invalid Qualifier on Strings
Nightslayer, check the dates on threads; this one is 4 years old.
-
May 5th, 2012, 09:53 PM
#10
Re: VBA Invalid Qualifier on Strings
Nightsiayer
Welcome to the Forums ..
It appears that you dilligently did a Search Forums on
Invalid Qualifier, and thus found this thread, but, as
Marty points out, this thread is ancient.
So, it might be appropriate to start a new thread.
Further, it would help if you would give a little more
code.
EDIT
BTW, I'm amazed at the number of Views of this thread ... 3,348 ..
and only 9 replies.
Spoo
Last edited by Spoo; May 5th, 2012 at 09:56 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|