Hi,
I was wondering if anyone might be able to help me.
I was trying to create a function that takes 2 arguments and i go
compiler error messages saying i need '=' expected.
Here is my code
filein = Application.GetOpenFilename()
ImportCSV (mysheet, filein)
in the function of ImportCV, i have
Function ImportCSV(sheet As String, inputfile As String)
..
end function
Any ideas?
Thank you in advanc
Ardus Petus - 09 Jun 2006 07:56 GMT
Sub ImportCSV(sheet As String, inputfile As String)
Since ImportCSV does not return a value, it is a Sub, not a Function
HTH
--
AP
"associates" <associates.294hdb_1149835801.657@excelforum-nospam.com> a
écrit dans le message de news:
associates.294hdb_1149835801.657@excelforum-nospam.com...
> Hi,
>
[quoted text clipped - 18 lines]
>
> Thank you in advance
Dave Peterson - 09 Jun 2006 15:16 GMT
Try removing the ()'s and make sure you pass the correct type of parms to the
function:
Option Explicit
Sub testme()
Dim mySheet As String
Dim inputfile As String
inputfile = Application.GetOpenFilename()
ImportCSV mySheet, inputfile
End Sub
Function ImportCSV(sheet As String, inputfile As String)
'do the work
MsgBox "hi"
End Function
> Hi,
>
[quoted text clipped - 24 lines]
> associates's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=35073
> View this thread: http://www.excelforum.com/showthread.php?threadid=550241

Signature
Dave Peterson
Dave Peterson - 09 Jun 2006 15:27 GMT
Ps. You can keep the ()'s if you use Call:
Option Explicit
Sub testme()
Dim mySheet As String
Dim inputfile As String
inputfile = Application.GetOpenFilename()
Call ImportCSV(mySheet, inputfile)
End Sub
Function ImportCSV(sheet As String, inputfile As String)
'do the work
MsgBox "hi"
End Function
> Try removing the ()'s and make sure you pass the correct type of parms to the
> function:
[quoted text clipped - 43 lines]
>
> Dave Peterson

Signature
Dave Peterson