Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default return value from a fucntion

I'm using the following function to verify the existance of a file

Private Function FileExists(fname) As Boolean
' Returns TRUE if the file exists
Dim x As String
x = Dir(fname)
If x < "" Then FileExists = True _
Else FileExists = False
End Function

I call FileExists(filename) from another routine and I need to know th
result from that check.

how can I check the return from that fucntion (either false or True) ?

thanks

Pab

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default return value from a fucntion

pabs < wrote:
I'm using the following function to verify the existance of a file

Private Function FileExists(fname) As Boolean
' Returns TRUE if the file exists
Dim x As String
x = Dir(fname)
If x < "" Then FileExists = True _
Else FileExists = False
End Function

I call FileExists(filename) from another routine and I need to know the
result from that check.

how can I check the return from that fucntion (either false or True) ?


Assign it to a variable like:

Answer = FileExists(Filename)

or use it directly:

If FileExists(Filename) Then
' Code if the file exists.
End If

Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default return value from a fucntion

Pabs,

Something like

If FileExists("C:\myFile.xls") = TRUE Then
' do your thing
Else
' do something els
End If

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"pabs " wrote in message
...
I'm using the following function to verify the existance of a file

Private Function FileExists(fname) As Boolean
' Returns TRUE if the file exists
Dim x As String
x = Dir(fname)
If x < "" Then FileExists = True _
Else FileExists = False
End Function

I call FileExists(filename) from another routine and I need to know the
result from that check.

how can I check the return from that fucntion (either false or True) ?

thanks

Pabs


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default return value from a fucntion

thanks.

it works...

Pabs


---
Message posted from http://www.ExcelForum.com/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pearson fucntion on excel Orlando Ochoa Excel Discussion (Misc queries) 1 November 13th 09 06:50 PM
IF Fucntion Help! Chabulo Excel Discussion (Misc queries) 2 April 10th 09 12:50 AM
Sumproduct Fucntion - the use of dash ( -- ) Negda Excel Worksheet Functions 11 April 5th 08 09:56 PM
Sumif Fucntion bcuinohio Excel Worksheet Functions 1 June 1st 05 11:47 PM
Sumif Fucntion Peo Sjoblom Excel Worksheet Functions 0 May 31st 05 11:32 PM


All times are GMT +1. The time now is 08:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"