Passing null or Optional values to functions in VB6

I have written a DLL function that takes 11 parameters, However all eleven parameters may not allways be needed.
How can I call my function in a way that I dont have to specify emtpy strings. ie like this:

     X = myFunction(Val1, Val2, Val3, , , , , , , Val10, Val11)

Currently I have to do this :

     X = myFunction(Val1, Val2, Val3, "", "", 0, 0, "", 0, Val10, Val11)

MSDN says:
An argument can only be omitted from a call to a user-defined procedure if it was declared Optional in the procedure declaration. Either supply the argument in the call or declare the parameter Optional in the definition.

I have tried:
Optional Val1 As String
Val1 As Optional String
Val1 As String Optional, etc

Please advise,
John
LVL 2
gjokAsked:
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.

DabasCommented:
John:

True, you can declare a parameter as optional, but once you have done so, all parameters AFTER that one must also be declared optional. If you want ALL parameters to be optional then your declarion should be:

Public Function myFunction(Optinal Val1 as String, Optional Val2 as String, Optional Val3 as String.... Optional Val11 as String) as Whatever

Dabas
0

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
gjokAuthor Commented:
Many thanks, that works great!
0
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.