Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Does file exist?

Is there a simple code for..

Does C:\fILE.XLS exist? if so then msgbox("Overwirte") else

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Does file exist?

ianripping wrote:

Is there a simple code for..

Does C:\fILE.XLS exist? if so then msgbox("Overwirte") else _


Check out Scripting.FileSystemObject

--
To top-post is human, to bottom-post and snip is sublime.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Does file exist?

Hi Ian,

Look at the Dir function.

For example:

If Len(Dir("C:\Test.xls")) 0 Then
'File found, Do something
Else
'File not found, Do something else
End If


---
Regards,
Norman


"ianripping " wrote in message
...
Is there a simple code for..

Does C:\fILE.XLS exist? if so then msgbox("Overwirte") else _


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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Does file exist?

Is there a simple code for..

Does C:\fILE.XLS exist? if so then msgbox("Overwirte") else _


Some code a mate gave me for this purpose:

Function isdasuckerthere(dapath As String, dafile As String) As Boolean
Dim foundfile As String
isdasuckerthere = False
foundfile = Dir(dapath & dafile)
If Not foundfile = "" Then isdasuckerthere = True
End Function

Sub example()
If isdasuckerthere(Cells(1, 1), "win.ini") Then
MsgBox "Found"
Else
MsgBox "Nope"
End If
End Sub

You can use this function (isdasuckerthere) in a worksheet or manipulate the
logic to use in VBA.

Damo


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Does file exist?

Thanks both work grea

--
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
does a file exist Arien Excel Discussion (Misc queries) 3 January 3rd 06 01:27 PM
does a deleted file still exist in my computer ? traderhorn Excel Discussion (Misc queries) 3 November 22nd 05 06:51 PM
Detecting If An .xls File Exist abxy[_60_] Excel Programming 2 May 7th 04 08:00 PM
excel macro looking for file that doesn't exist regisphilbin Excel Programming 2 September 26th 03 03:37 AM
does a file exist? Keith Willshaw Excel Programming 0 September 10th 03 04:42 PM


All times are GMT +1. The time now is 10:58 AM.

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"