Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Creating FileSystemObject

I have the following code:

Public Function FolderExists(folderspec)
Dim fso As Object
Dim blnFolderExist As Boolean

Set fso = CreateObject("VBA.FileSystemObject")

If fso.FolderExists(folderspec) Then
MsgBox "Folder Exists"
Else
MsgBox "Folder Does Not Exist"
End If


End Function

I am attempting to verify that a folder path exists that
a user inputs.

I get a Run-time error '429': ActiveX componetn can't
create object.

I checked my references and the VBA Library exists with
FileSystem. I tried only FileSystem, but got the same
error.

I need to be able to verify that a path a user enters in
a UserForm exists. Am I on the right track? What do I
need to do to get the above code to work? Any help would
be appreciated. Thanks.


Kirk
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Creating FileSystemObject

Kirk,

FileSystemObject is part of Scripting not VBA. So use

Set fso = CreateObject("Scripting.FileSystemObject")


--

HTH

Bob Phillips

"Kirk" wrote in message
...
I have the following code:

Public Function FolderExists(folderspec)
Dim fso As Object
Dim blnFolderExist As Boolean

Set fso = CreateObject("VBA.FileSystemObject")

If fso.FolderExists(folderspec) Then
MsgBox "Folder Exists"
Else
MsgBox "Folder Does Not Exist"
End If


End Function

I am attempting to verify that a folder path exists that
a user inputs.

I get a Run-time error '429': ActiveX componetn can't
create object.

I checked my references and the VBA Library exists with
FileSystem. I tried only FileSystem, but got the same
error.

I need to be able to verify that a path a user enters in
a UserForm exists. Am I on the right track? What do I
need to do to get the above code to work? Any help would
be appreciated. Thanks.


Kirk



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
Scripting.FileSystemObject Leif Rasmussen Excel Discussion (Misc queries) 1 January 12th 05 11:21 PM
FileSystemObject And Excel Amod Excel Programming 0 September 6th 03 07:10 AM
Help with FileSystemObject? Ed[_9_] Excel Programming 2 August 5th 03 12:08 AM
FileSystemObject question Tod Excel Programming 3 August 2nd 03 06:08 PM
FileSystemObject to get last 10 lines of text file. john Excel Programming 11 July 16th 03 03:54 PM


All times are GMT +1. The time now is 02:03 PM.

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

About Us

"It's about Microsoft Excel"