Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default FileSystemObject help please.

Set strFileToLookFor = fsoFileExists.fileexists(strFullPath)
should be

Dim strFileToLookFor as Boolean
strFileToLookFor = fsoFileExists.fileexists(strFullPath)

or you can skip the intermediate variable and do
blnExists = fsoFileExists.fileexists(strFullPath)

--
Regards,
Tom Ogilvy


"DaveO" wrote in message
...
I have a check box, and when checked I want to open a document. I know

where
this document will be, but I want the latest version of it.

All of the file names will be the same except that it will have a marker

to
denote what version. What I can't figure is how to do this properly.

I know that I can use the FileSystemObject and the FileExists method, but
can't seem to get it working.

Here's the code ...

Private Sub chkBMHFups_Click()

strRequired = "BMHFups"
intCounter = 1
blnExists = True

If chkBMHFups Then

Set fsoFileExists = CreateObject("Scripting.FileSystemObject")

Do While blnExists

strFullPath = fctWhereToLook & Left(strRequired,

Len(strRequired) -
4) & intCounter & Right(strRequired, 4)

Set strFileToLookFor = fsoFileExists.fileexists(strFullPath)

intCounter = intCounter + 1
blnExists = strFileToLookFor

Loop

End If

Set fsoFileExists = Nothing
strRequired = ""
intCounter = 1
blnExists = False

End Sub

fctWhereToLook is working fine, but it errors when I get to the ...

Set strFileToLookFor = fsoFileExists.fileexists(strFullPath)

The error is this...

Run-time error '424':

Object required.

I'm not sure how to use this funtion so any help would be gratefully

received.

Thanks.



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
Filesystemobject Help CyndyG Excel Programming 4 May 17th 05 01:00 AM
filesystemobject Alvin Hansen[_2_] Excel Programming 2 February 16th 05 03:47 PM
filesystemobject Alvin Hansen[_2_] Excel Programming 3 January 27th 05 06:17 PM
FileSystemObject lol[_2_] Excel Programming 2 April 6th 04 09:56 PM
Help with FileSystemObject? Ed[_9_] Excel Programming 2 August 5th 03 12:08 AM


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