Upper() in VBA

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

Just beginning my foray into VBA.

Attempting the following:

Error message Compile error: Sub or function not defined
Upper() is highlighted in blue

Sub GetMyView()

Dim MyView As String
Do Until upper(MyView) = "[ALL]" Or upper(MyView) = _
"[CMI]" Or upper(MyView) = "[XL]"
MyView = InputBox("Enter CMI or XL or ALL", "Enter Desired View")
Loop

End Sub


in John Walkenbach's VBA 2003 programming book (Page 364) the only use of Excel's
UPPER() function showed this string technique used above "[ALL]".

What is the purpose of "[xxxx]" vs.. "xxxx"?

Is the Upper functions supported in VBA? If so, any syntax differences vs. Excel?

TIA Dennis
 
Dennis,

Try UCase. Upper is a worksheet function, not VBA.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
If those appear in the book, then they're typos, too.

John posts known errors on his web site:
http://www.j-walk.com/ss/books/xl03pperrors.htm

I just looked and currently it says "none".

But there's a link to let him know. (You might be the first to find it!)
Just beginning my foray into VBA.

Attempting the following:

Error message Compile error: Sub or function not defined
Upper() is highlighted in blue

Sub GetMyView()

Dim MyView As String
Do Until upper(MyView) = "[ALL]" Or upper(MyView) = _
"[CMI]" Or upper(MyView) = "[XL]"
MyView = InputBox("Enter CMI or XL or ALL", "Enter Desired View")
Loop

End Sub

in John Walkenbach's VBA 2003 programming book (Page 364) the only use of Excel's
UPPER() function showed this string technique used above "[ALL]".

What is the purpose of "[xxxx]" vs.. "xxxx"?

Is the Upper functions supported in VBA? If so, any syntax differences vs. Excel?

TIA Dennis
 
Back
Top