Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Use sub


Use sub

Author
Message
samuvk
samuvk
Forum God
Forum God (2.1K reputation)Forum God (2.1K reputation)Forum God (2.1K reputation)Forum God (2.1K reputation)Forum God (2.1K reputation)Forum God (2.1K reputation)Forum God (2.1K reputation)Forum God (2.1K reputation)Forum God (2.1K reputation)

Group: Forum Members
Posts: 7, Visits: 16
I'm using Visual Basic in Excel 2003.

I have a Sub definied as follow:

Public Sub Conect(ByVal hServer As Long, ByVal hpool As Long, ByVal vServerName As Long, ByVal vUserName As Long, ByVal vPassword As Long, hUser As Long)

  BODY

End Sub

The thing is when I try to call the Sub I'm doing as follow:

Sub Conect(hServer, hpool, vServerName, vUserName , vPassword , hUser Wink

When I call the Sub I get the next error message:

Compile error:

Expected:=

Could anyone help me to understand why is this happening and how can I fix it?

The thing is that when I use only one variable I don't have any problem

Joey
Joey
Forum God
Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)

Group: Forum Members
Posts: 72, Visits: 46
When you're calling the sub either get rid of the parentheses like this,

Conect hServer, hpool, vServerName, vUserName , vPassword , hUser 

or, leave the parentheses and use the CALL keyword, like this,

Call Conect(hServer, hpool, vServerName, vUserName , vPassword , hUser)

You were getting the error because it was expecting a return value from a function to be assigned to a variable such as,

myConString = Conect(hServer, hpool, vServerName, vUserName , vPassword , hUser)

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search