By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,488 Members | 2,552 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,488 IT Pros & Developers. It's quick & easy.

Is it correct to call a Public Sub w/o enclosing arguments in parentheses?

P: n/a
MLH
SendMailPlusWithOE Subject, Message, Recipients, Files, "08"

I've seen the above syntax used to call the sub SendMailPlusWithOE

Is it correct/incorrect/good practice/bad practice or just a matter of
personal preference?
Jan 10 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
It's correct syntax, so it boils down to style.

My presonal preference is to use the Call keyword, and include the brackets.
I find that's more readable and consistent across VBA versions, and the same
syntax works regardless of whether you are calling a Function or Sub, e.g.:
Call Text1_BeforeUpdate(Cancel)
Call MyFunctionWhereIDontCareAboutReturnValue(SomeVar)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"MLH" <CR**@NorthState.netwrote in message
news:37********************************@4ax.com...
SendMailPlusWithOE Subject, Message, Recipients, Files, "08"

I've seen the above syntax used to call the sub SendMailPlusWithOE

Is it correct/incorrect/good practice/bad practice or just a matter of
personal preference?
Jan 10 '07 #2

P: n/a
"Allen Browne" <Al*********@SeeSig.Invalidwrote in
news:45***********************@per-qv1-newsreader-01.iinet.net.au:
It's correct syntax, so it boils down to style.

My presonal preference is to use the Call keyword, and include the
brackets. I find that's more readable and consistent across VBA
versions, and the same syntax works regardless of whether you are
calling a Function or Sub, e.g.:
Call Text1_BeforeUpdate(Cancel)
Call MyFunctionWhereIDontCareAboutReturnValue(SomeVar)
Try

MyFunctionWhereIDontCareAboutReturnValue SomeVar

I think you will find that it works as well.

--
lyle fairfield
Jan 10 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.