Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy > > >

Tree View in Excel


(!)

mailsatk's Avatar
mailsatk mailsatk is offline
Member with 65 posts.
THREAD STARTER
 
Join Date: Mar 2005
31-Oct-2006, 02:22 AM #1
Tree View in Excel
Hello people!

I am trying to do something that I don't know if anyone else might have tried before...I am writing a Macro in Excel that will give a user the list of all the folders present within a selected folder. I have been successful in getting that onto a spreadsheet using the Shell command...

This is important for Project Managers who need to work with a lot of directories for their projects...especially when they want to create a new one for their project taking an old one as a base...the PM would typically add/modify/delete from the existing directory structure.

Now here is what I want:
I want the user to be able to add/modify/delete the directory structure according to his/her needs and specify a location and hit some button - that will create the new directory structure at the new location specified by the user. The problem is that the dump that I get from the Shell command is not very user friendly to add/modify/delete the directories. For example:
User wants the dump of C:\Data and gets the following on a spreadsheet (with the Shell command) -

http://img135.imageshack.us/img135/6...enprintiv2.png

where Exchange, n014996 and N212710 are the folders within C:\Data. Temp is the only folder within Exchange. Similarly, the folder n014996 contains 5 sub-folders. There are no sub-folders within N212710.

Here, the user may choose to add a new folder within C:\Data or modify any of the existing folders or even delete. I want the user to be able to do it with the help of some GUI where he can see the entire folder structure in a Tree format (the way Windows explorer shows it). Any ideas how I can achieve that using VBA and Excel?

Thanks!
-Satish
mailsatk's Avatar
mailsatk mailsatk is offline
Member with 65 posts.
THREAD STARTER
 
Join Date: Mar 2005
02-Nov-2006, 08:57 AM #2
Let me rephrase the question -

Is there any way I can represent the data that is present on the Excel (see image) in a Treeview control in Excel using VBA?

http://img135.imageshack.us/img135/6...enprintiv2.png

Thanks
Satish
OBP's Avatar
OBP OBP is offline OBP is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 18,524 posts.
 
Join Date: Mar 2005
Location: UK
02-Nov-2006, 09:15 AM #3
Satish, I am not familiar with a Treeview control. But I do know that there are plenty of ways for Excel VBA to interact with the microsoft folder system.
I suggest that you go in to the Excel VB Editor and open the VB Help (not Excel's) and type in the search field
dir
that will lead you to lot's of functionality for dealing with files and folders, combine that with string manipulation and you should be able to do something.
__________________
OBP
I do not give up easily
Zack Barresse's Avatar
Computer Specs
Member with 5,434 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
02-Nov-2006, 01:34 PM #4
Check this out, it may help...

http://puremis.net/excel/code/080.shtml

HTH
mairembam's Avatar
mairembam mairembam is offline
Junior Member with 1 posts.
 
Join Date: May 2008
22-May-2008, 12:49 AM #5
Creating Tree Format in excel
Here is one easy way that I found out to create a tree format in excel.

See http://mairembam.blogspot.com
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑