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

One way:

Option Explicit
Sub test()
Dim bGotIt As Boolean
Dim sFile As String
Dim sPath As String
Dim testStr As String

sFile = "Book1.xls"
sPath = "a:\temp\"

testStr = ""
On Error Resume Next
bGotIt = (Len(testStr) 0)
On Error GoTo 0

MsgBox bGotIt

End Sub




ceemo wrote:

This works great but if i am pointing to th a: drive and there isnt a
floppy in it the macro will fall over. Is there anyway arond this?

Sub test()
Dim bGotIt As Boolean
Dim sFile As String
Dim sPath As String

sFile = "Book1.xls"
sPath = "c:\temp\"

'On Error Resume Next
bGotIt = (LCase(sFile) = LCase(Dir(sPath & sFile)))
'On Error GoTo 0

MsgBox bGotIt

End Sub

--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=400396


--

Dave Peterson
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
User replaces existing file with blank during file open sjs Excel Discussion (Misc queries) 3 August 18th 08 06:16 PM
Importing text file, only option to edit existing file smokey99 Excel Discussion (Misc queries) 8 April 26th 06 09:08 PM
Creating a new excel file from an existing file using macro Macro Excel Programming 2 July 28th 05 06:40 PM
can i save an existing .xls file as a .csv file using command line craigkan Excel Discussion (Misc queries) 2 February 18th 05 02:01 PM
get path - save new file - same sub-directory as existing file tegger Excel Programming 2 October 21st 03 10:45 AM


All times are GMT +1. The time now is 04:53 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"