473,326 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to Get SubFolder of a Particular Folder

mafaisal
142 100+
Hello,

I am Using VB6

Here Hw to Get SubFolder Names of Given Folder

I have here Code But Error is coming

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim FSO As New FileSystemObject
  3. Dim FOL As Folder
  4. Dim Path As String
  5. Path = InputBox("Enter Path")
  6. Set FOL = FSO.GetFolder(Path)
  7. Dim i As Integer
  8. For i = 1 To FOL.SubFolders.Count
  9.  MsgBox FOL.SubFolders.Item(i).Name
  10. Next
  11.  
  12.  
Here Error is coming, Plz Give me reply

Faisal
Feb 22 '08 #1
1 4728
VBWheaties
145 100+
Hello,

I am Using VB6

Here Hw to Get SubFolder Names of Given Folder

I have here Code But Error is coming

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim FSO As New FileSystemObject
  3. Dim FOL As Folder
  4. Dim Path As String
  5. Path = InputBox("Enter Path")
  6. Set FOL = FSO.GetFolder(Path)
  7. Dim i As Integer
  8. For i = 1 To FOL.SubFolders.Count
  9.  MsgBox FOL.SubFolders.Item(i).Name
  10. Next
  11.  
  12.  
Here Error is coming, Plz Give me reply

Faisal

Not sure what the error is but I would change it to use FOR..EACH loop as the following example illustrates:

Expand|Select|Wrap|Line Numbers
  1. Sub ShowFolderList(folderspec)
  2.     Dim fs, f, f1, fc, s
  3.     Set fs = New FileSystemObject
  4.     Set f = fs.GetFolder(folderspec)
  5.     Set fc = f.SubFolders
  6.     For Each f1 in fc
  7.         s = s & f1.name 
  8.         s = s &  vbCrLf
  9.     Next
  10.     MsgBox s
  11. End Sub
  12.  
Feb 22 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be...
2
by: | last post by:
Let me explain step wise. 1.. I have a site running on port 5555 2.. If contains web.config file with contains <Forms> authentication. 3.. The site contains a sub-folder named "MembersArea"...
0
by: ChristianD | last post by:
for some reason i can't access a resource (.js) if the control files and the resource are in a subfolder off the project root or just the resource is in a subfolder. the code is as follows (...
3
by: walter | last post by:
Hi , I thought it's simple ,but end up come here for help(as lots of other times). --I have several HttpModule added in the root thru web.config, but I want to remove some and add some new ones in...
2
by: Jon Paal | last post by:
after submitting a form, I create and new subfolder and attempt to save images into that folder, two steps both as part of the form processing. works fine on my local machine .. fails on webhost....
7
by: MarkusJNZ | last post by:
Hi, I have a website called www.websitename.com which is an ASP.NET 2.0 website. I need to create another application (Which I want to be totally seperate from the above website) but for...
6
by: Thanh-Nhan Le | last post by:
Hello, I have an ASP application on IIS server: http://localhost/myApp I use ASP and a my own VB activex DLL to create a pdf file and write this file to a subfolder of the Application folder:...
5
by: woolls01 | last post by:
I am using the following code Sub Ck() Dim strStartPath As String strStartPath = "d:\workpack\rra" ListFolder strStartPath End Sub
1
by: Zitomd | last post by:
I'd like some help in using the DIR() or FSO to search for a subfolder that contains a string entered from a textbox. I can get the subfolder if the user enters the exact SubFolder name (ie...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.