-
This is bizarre to say the least...
I have a single form, and a class module in a small project.
In my class I have a method called 'Sendmail' that looks like this:
Public Sub SendMail(strFrom As String, strSubject As String, strBodyText As String)
<code deleted cuz it's not relevant to the problem>
End Sub
The code that calls this method is:
objGWMail.SendMail("Davis", "test1", "test1")
REALLY SIMPLE!! Or so it should be...Problem is, I get the following error every time:
"COMPILE ERROR, Expected: = "
So apparently VB thinks my method is a FUNCTION which it clearly is not. BUT when I make it into a function, it works fine!
I've built plenty of classes and COM components, so this is not new to me, but am I missing something totally obvious here?? (Haven't had lunch yet so it's possible :) Or is this a known bug of some kind?
As a last resort I'm about to strip out all the code and put it in a new module.
-
Try calling the method without the parentheses.
objGWMail.SendMail "Davis", "test1", "test1"
When its called with the parantheses VB assumes it's a function. I thing you could also call it this way:
call objGWMail.SendMail("Davis", "test1", "test1")
:):)
-
Aargh! Ya that's it, I missed the Call statement. Man that's so obvious (told ya it was probably something obvious :) That's what happens when you go without food too long!
<blush>
Thx.