﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>A1VBCode Forums / Classic Visual Basic (VB 6 or earlier) / VBA(Excel, Word, etc...)  / Use sub / Latest Posts</title><generator>InstantForum.NET v4.1.1</generator><description>A1VBCode Forums</description><link>http://www.a1vbcode.com/vbforums/</link><webMaster>forums@a1vbcode.com</webMaster><lastBuildDate>Thu, 09 Feb 2012 04:39:15 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Use sub</title><link>http://www.a1vbcode.com/vbforums/Topic28775-14-1.aspx</link><description>When you're calling the sub either get rid of the parentheses like this,&lt;/P&gt;&lt;P&gt;Conect hServer, hpool, vServerName, vUserName , vPassword , hUser &lt;/P&gt;&lt;P&gt;or, leave the parentheses and use the CALL keyword, like this,&lt;/P&gt;&lt;P&gt;Call Conect(hServer, hpool, vServerName, vUserName , vPassword , hUser)&lt;/P&gt;&lt;P&gt;You were getting the error because it was expecting a return value from a function to be assigned to a variable such as,&lt;/P&gt;&lt;P&gt;myConString = Conect(hServer, hpool, vServerName, vUserName , vPassword , hUser)</description><pubDate>Sat, 30 Jan 2010 10:58:07 GMT</pubDate><dc:creator>Joey</dc:creator></item><item><title>Use sub</title><link>http://www.a1vbcode.com/vbforums/Topic28775-14-1.aspx</link><description>I'm using Visual Basic in Excel 2003.&lt;/P&gt;&lt;P&gt;I have a Sub definied as follow:&lt;/P&gt;&lt;P&gt;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) &lt;/P&gt;&lt;P&gt;  BODY&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;The thing is when I try to call the Sub I'm doing as follow:&lt;/P&gt;&lt;P&gt;Sub Conect(hServer, hpool, vServerName, vUserName , vPassword , hUser&amp;nbsp&lt;img align="absmiddle" src="http://www.a1vbcode.com/vbforums/Skins/Classic/Images/EmotIcons/Wink.gif" border="0" title="Wink"&gt; &lt;/P&gt;&lt;P&gt;When I call the Sub I get the next error message:&lt;/P&gt;&lt;P&gt;Compile error: &lt;/P&gt;&lt;P&gt;Expected:=&lt;/P&gt;&lt;P&gt;Could anyone help me to understand why is this happening and how can I fix it?&lt;/P&gt;&lt;P&gt;The thing is that when I use only one variable I don't have any problem</description><pubDate>Thu, 28 Jan 2010 15:13:10 GMT</pubDate><dc:creator>samuvk</dc:creator></item></channel></rss>
