How to call a function in vb

How do I call a function in vb?

In the immediate window, I have entered:
importPOItems("C:\Program Files\filename",2)

the function is defined as follows:

 Sub ImportPOItems(ByRef sFileName As String, intControlRef As Integer)
 End Sub

Compile Error:
Expected: =

When I take out the 2 from the call and the subroutine, it works.

Thank you in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Can we see the subroutine??
or try:

importPOItems "C:\Program Files\filename",2
Farzad AkbarnejadDeveloperCommented:
Hi swansonplace,
I think that you define it in form. You must define it in Module to run it from Debug windows

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Without the brackets should work.
Right. Using brakets here needs a leading "call ", so
call importPOItems("C:\Program Files\filename",2) should work too,
(if the function is not in an form or a class (which needs an instance, which does not exist in design time))
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Call importPOItems("C:\Program Files\filename",2) should work, but the way you did it should work as well.

Instead of Sub make it Public Sub, and make sure it's in a separate code module, and see what happens.

Call importPOItems("C:\Program Files\filename",2)  works as well.

But like KnobiKnobi said:
<if the function is not in an form or a class (which needs an instance, which does not exist in design time))>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
swansonplaceAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.