| | | Forum Newbie
       
Group: Forum Members Last Login: 9/22/2010 9:15:29 AM 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  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 |
| | | | Forum Member
       
Group: Forum Members Last Login: 3/17/2011 8:55:21 PM Posts: 57, Visits: 31 |
| | 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) |
| |
|
|