Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / June 2006

Tip: Looking for answers? Try searching our database.

Issue with passing values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
associates - 09 Jun 2006 07:46 GMT
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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.