Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subroutine call error

Status
Not open for further replies.

Daedelus

Technical User
Aug 14, 2002
70
US
I have a subroutine declared by the following line:

Sup Fliprows (ByVal tp as String, ByVal bot as String)

I have tried to call it with the line:

Fliprows ("ZMeetings", "ZSixSigma")

When I try to enter this line, however, the VB Editor comes back with:

Compile Error:
Expected: =

Try as I might, I have not been able to figure out why VB expects an "=" anywhere in this expression, or even where it thinks one ought to be. I have tried a number of things, such as replacing the constants with variables, but VB still rejects it. The only thing that works is to put "Call " in front. Then VB thinks everything is fine.

While I can do this, I would really like to know why it won't accept the statement without "Call". Everything I've read or done before indicates it ought to.
 
Just remove the parentheses ..

Fliprows "ZMeetings", "ZSixSigma"

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
I searched until I found the help pages explaining this. This has got be one of the most ridiculous syntactical rules I have ever come across!

Parentheses are required for functions when returning a value, but cannot be used when ignoring the value. Parentheses cannot be used when calling a function, unless using a "Call" statement, for which they are required again!

What did they do? Pull out a dart board when deciding where parentheses ought to be, and where they shouldn't?
 
Shrug....if that is the worst you have found yet...I hate to tell you this, but you may have a few more surprises.

Gerry
 
I first learned to program 28 years ago with whatever version of basic was implemented on the HP2000 mainframe systems. While I am not a true programmer, I have used a wide variety of languages over the years, and learned some basics of others. I have seen some truly torturous syntaxes.

What bugs me about this one, though, is the arbitrary and inconsistent nature about when to and when not to include parentheses. Most languages either require them everywhere, or at least allow them everywhere. Some deny them everywhere. This one, for no good reason that I can discern, denies their usage in some places, but demands them in other places, for the same thing![hammer]

Occasionally, I just have to rant about this sort of thing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top