#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default File Exists

I am having a macro search for a file on the desktop under "C:\Documents and
Settings\All Users\Desktop\" using "result = Object.FileExists(file_name)".
I know the file exists, but the result is always false. Is there something
wrong with FileExists, or should I do something different?

Thanks,

Matthew
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default File Exists


Good morning Pflugs

This code will return true or false (displayed in a msgbox) when
checking for a file.

Sub DoesFileExist()
Set MyFile = CreateObject("Scripting.FileSystemObject")
MsgBox MyFile.FileExists("c:\book1.xls")
End Sub

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=401651

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 230
Default File Exists

You say you know it exists ... I assume because you see it on your
desktop... Are you sure it is in All Users\Desktop and not rather in your
own UserName\Desktop? They are not the same path, even though files in
either will show on (your) desktop.

Bill

"Pflugs" wrote in message
...
I am having a macro search for a file on the desktop under "C:\Documents
and
Settings\All Users\Desktop\" using "result =
Object.FileExists(file_name)".
I know the file exists, but the result is always false. Is there
something
wrong with FileExists, or should I do something different?

Thanks,

Matthew



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
File Exists Formula El Bee Excel Worksheet Functions 4 November 9th 06 03:45 PM
File Exists Mike McLellan Excel Discussion (Misc queries) 2 May 4th 06 09:20 AM
IF File Exists [email protected] Excel Programming 1 November 22nd 04 07:24 PM
File already exists Michael Malinsky[_3_] Excel Programming 0 June 28th 04 08:02 PM
the file already exists - do you want to replace the existing file? Paul James[_3_] Excel Programming 4 December 12th 03 02:50 AM


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