PC Review


Reply
Thread Tools Rate Thread

Creating Windows Folders

 
 
Rich K
Guest
Posts: n/a
 
      4th Mar 2009
I'm automating the creation of windows folders from a stored procedure in an
Access Module. I ask the user for a name for the folder after he's
identified the location.
What I'm looking for is code that varifies that the name is a valid windows
folder name before I try to create it. Is there something built into vba for
this purpose?

Thanks.
 
Reply With Quote
 
 
 
 
dymondjack
Guest
Posts: n/a
 
      4th Mar 2009
Check out the Dir() function

If you look at the help file, it will tell you how to use the arguments.
One of them can be used for dealing with directories. I don't remember the
syntax offhand, but if you should be able to pass the proposed name and the
vbDirectory constant to check for the existance of the folder.

hth

--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain


"Rich K" wrote:

> I'm automating the creation of windows folders from a stored procedure in an
> Access Module. I ask the user for a name for the folder after he's
> identified the location.
> What I'm looking for is code that varifies that the name is a valid windows
> folder name before I try to create it. Is there something built into vba for
> this purpose?
>
> Thanks.

 
Reply With Quote
 
Rich K
Guest
Posts: n/a
 
      4th Mar 2009
Actually, the MkDir($Name) function is perfect for creating a folder with the
name $name.
What I'm looking for is a function that will varify if $Name is a valid
windows folder name before I pass it. I'm building the folders while
simultaneously building a tree view. I have to build the tree view first,
and then create the folder.

If I can validate the folder name prior to the tree view, I can simple abort
the process, but if I have to wait until I try to create the folder to find
out if it can be created, I would have to roll back several functions.

Thanks.

"dymondjack" wrote:

> Check out the Dir() function
>
> If you look at the help file, it will tell you how to use the arguments.
> One of them can be used for dealing with directories. I don't remember the
> syntax offhand, but if you should be able to pass the proposed name and the
> vbDirectory constant to check for the existance of the folder.
>
> hth
>
> --
> Jack Leach
> www.tristatemachine.com
>
> - "First, get your information. Then, you can distort it at your leisure."
> - Mark Twain
>
>
> "Rich K" wrote:
>
> > I'm automating the creation of windows folders from a stored procedure in an
> > Access Module. I ask the user for a name for the folder after he's
> > identified the location.
> > What I'm looking for is code that varifies that the name is a valid windows
> > folder name before I try to create it. Is there something built into vba for
> > this purpose?
> >
> > Thanks.

 
Reply With Quote
 
dymondjack
Guest
Posts: n/a
 
      4th Mar 2009
Ah...

I'm not sure about a vba function to validate a prospective folder name. I
thought you meant to check for the existence of that folder first.

I suppose an alternative would be to run the mkdir command, and before going
much further, check to see if that directory now exists (using the Dir
function). If it doesn't exist, obviously there was some error creating it,
and you can abort your treeview process. For example, have a 'dummy' folder
set up in your db location to perform this test before starting on the
treeview.

That would be the only way that I know off the top of my head, though it
does seem as thought there would be an API to handle something like this.
Probably there is, I just don't know of it.

--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain


"Rich K" wrote:

> Actually, the MkDir($Name) function is perfect for creating a folder with the
> name $name.
> What I'm looking for is a function that will varify if $Name is a valid
> windows folder name before I pass it. I'm building the folders while
> simultaneously building a tree view. I have to build the tree view first,
> and then create the folder.
>
> If I can validate the folder name prior to the tree view, I can simple abort
> the process, but if I have to wait until I try to create the folder to find
> out if it can be created, I would have to roll back several functions.
>
> Thanks.
>
> "dymondjack" wrote:
>
> > Check out the Dir() function
> >
> > If you look at the help file, it will tell you how to use the arguments.
> > One of them can be used for dealing with directories. I don't remember the
> > syntax offhand, but if you should be able to pass the proposed name and the
> > vbDirectory constant to check for the existance of the folder.
> >
> > hth
> >
> > --
> > Jack Leach
> > www.tristatemachine.com
> >
> > - "First, get your information. Then, you can distort it at your leisure."
> > - Mark Twain
> >
> >
> > "Rich K" wrote:
> >
> > > I'm automating the creation of windows folders from a stored procedure in an
> > > Access Module. I ask the user for a name for the folder after he's
> > > identified the location.
> > > What I'm looking for is code that varifies that the name is a valid windows
> > > folder name before I try to create it. Is there something built into vba for
> > > this purpose?
> > >
> > > Thanks.

 
Reply With Quote
 
dymondjack
Guest
Posts: n/a
 
      4th Mar 2009
http://www.xtremevbtalk.com/showthread.php?t=207612

Try that.

The first response seems pretty good, the second one requires an added
reference, which I would not prefer.
--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain


"dymondjack" wrote:

> Ah...
>
> I'm not sure about a vba function to validate a prospective folder name. I
> thought you meant to check for the existence of that folder first.
>
> I suppose an alternative would be to run the mkdir command, and before going
> much further, check to see if that directory now exists (using the Dir
> function). If it doesn't exist, obviously there was some error creating it,
> and you can abort your treeview process. For example, have a 'dummy' folder
> set up in your db location to perform this test before starting on the
> treeview.
>
> That would be the only way that I know off the top of my head, though it
> does seem as thought there would be an API to handle something like this.
> Probably there is, I just don't know of it.
>
> --
> Jack Leach
> www.tristatemachine.com
>
> - "First, get your information. Then, you can distort it at your leisure."
> - Mark Twain
>
>
> "Rich K" wrote:
>
> > Actually, the MkDir($Name) function is perfect for creating a folder with the
> > name $name.
> > What I'm looking for is a function that will varify if $Name is a valid
> > windows folder name before I pass it. I'm building the folders while
> > simultaneously building a tree view. I have to build the tree view first,
> > and then create the folder.
> >
> > If I can validate the folder name prior to the tree view, I can simple abort
> > the process, but if I have to wait until I try to create the folder to find
> > out if it can be created, I would have to roll back several functions.
> >
> > Thanks.
> >
> > "dymondjack" wrote:
> >
> > > Check out the Dir() function
> > >
> > > If you look at the help file, it will tell you how to use the arguments.
> > > One of them can be used for dealing with directories. I don't remember the
> > > syntax offhand, but if you should be able to pass the proposed name and the
> > > vbDirectory constant to check for the existance of the folder.
> > >
> > > hth
> > >
> > > --
> > > Jack Leach
> > > www.tristatemachine.com
> > >
> > > - "First, get your information. Then, you can distort it at your leisure."
> > > - Mark Twain
> > >
> > >
> > > "Rich K" wrote:
> > >
> > > > I'm automating the creation of windows folders from a stored procedure in an
> > > > Access Module. I ask the user for a name for the folder after he's
> > > > identified the location.
> > > > What I'm looking for is code that varifies that the name is a valid windows
> > > > folder name before I try to create it. Is there something built into vba for
> > > > this purpose?
> > > >
> > > > Thanks.

 
Reply With Quote
 
Rich K
Guest
Posts: n/a
 
      4th Mar 2009
Thanks for the input.
I think I'll go ahead and change my code to create the folder first. I was
hoping for a quick solution but I think yours will end up being as elegant as
anything I can come up with.

"dymondjack" wrote:

> Ah...
>
> I'm not sure about a vba function to validate a prospective folder name. I
> thought you meant to check for the existence of that folder first.
>
> I suppose an alternative would be to run the mkdir command, and before going
> much further, check to see if that directory now exists (using the Dir
> function). If it doesn't exist, obviously there was some error creating it,
> and you can abort your treeview process. For example, have a 'dummy' folder
> set up in your db location to perform this test before starting on the
> treeview.
>
> That would be the only way that I know off the top of my head, though it
> does seem as thought there would be an API to handle something like this.
> Probably there is, I just don't know of it.
>
> --
> Jack Leach
> www.tristatemachine.com
>
> - "First, get your information. Then, you can distort it at your leisure."
> - Mark Twain
>
>
> "Rich K" wrote:
>
> > Actually, the MkDir($Name) function is perfect for creating a folder with the
> > name $name.
> > What I'm looking for is a function that will varify if $Name is a valid
> > windows folder name before I pass it. I'm building the folders while
> > simultaneously building a tree view. I have to build the tree view first,
> > and then create the folder.
> >
> > If I can validate the folder name prior to the tree view, I can simple abort
> > the process, but if I have to wait until I try to create the folder to find
> > out if it can be created, I would have to roll back several functions.
> >
> > Thanks.
> >
> > "dymondjack" wrote:
> >
> > > Check out the Dir() function
> > >
> > > If you look at the help file, it will tell you how to use the arguments.
> > > One of them can be used for dealing with directories. I don't remember the
> > > syntax offhand, but if you should be able to pass the proposed name and the
> > > vbDirectory constant to check for the existance of the folder.
> > >
> > > hth
> > >
> > > --
> > > Jack Leach
> > > www.tristatemachine.com
> > >
> > > - "First, get your information. Then, you can distort it at your leisure."
> > > - Mark Twain
> > >
> > >
> > > "Rich K" wrote:
> > >
> > > > I'm automating the creation of windows folders from a stored procedure in an
> > > > Access Module. I ask the user for a name for the folder after he's
> > > > identified the location.
> > > > What I'm looking for is code that varifies that the name is a valid windows
> > > > folder name before I try to create it. Is there something built into vba for
> > > > this purpose?
> > > >
> > > > Thanks.

 
Reply With Quote
 
Rich K
Guest
Posts: n/a
 
      4th Mar 2009
I think I just changed my mind and will use the first one.
I had thought of that originally but figured I'd miss some charactors to
evaluate.

"dymondjack" wrote:

> http://www.xtremevbtalk.com/showthread.php?t=207612
>
> Try that.
>
> The first response seems pretty good, the second one requires an added
> reference, which I would not prefer.
> --
> Jack Leach
> www.tristatemachine.com
>
> - "First, get your information. Then, you can distort it at your leisure."
> - Mark Twain
>
>
> "dymondjack" wrote:
>
> > Ah...
> >
> > I'm not sure about a vba function to validate a prospective folder name. I
> > thought you meant to check for the existence of that folder first.
> >
> > I suppose an alternative would be to run the mkdir command, and before going
> > much further, check to see if that directory now exists (using the Dir
> > function). If it doesn't exist, obviously there was some error creating it,
> > and you can abort your treeview process. For example, have a 'dummy' folder
> > set up in your db location to perform this test before starting on the
> > treeview.
> >
> > That would be the only way that I know off the top of my head, though it
> > does seem as thought there would be an API to handle something like this.
> > Probably there is, I just don't know of it.
> >
> > --
> > Jack Leach
> > www.tristatemachine.com
> >
> > - "First, get your information. Then, you can distort it at your leisure."
> > - Mark Twain
> >
> >
> > "Rich K" wrote:
> >
> > > Actually, the MkDir($Name) function is perfect for creating a folder with the
> > > name $name.
> > > What I'm looking for is a function that will varify if $Name is a valid
> > > windows folder name before I pass it. I'm building the folders while
> > > simultaneously building a tree view. I have to build the tree view first,
> > > and then create the folder.
> > >
> > > If I can validate the folder name prior to the tree view, I can simple abort
> > > the process, but if I have to wait until I try to create the folder to find
> > > out if it can be created, I would have to roll back several functions.
> > >
> > > Thanks.
> > >
> > > "dymondjack" wrote:
> > >
> > > > Check out the Dir() function
> > > >
> > > > If you look at the help file, it will tell you how to use the arguments.
> > > > One of them can be used for dealing with directories. I don't remember the
> > > > syntax offhand, but if you should be able to pass the proposed name and the
> > > > vbDirectory constant to check for the existance of the folder.
> > > >
> > > > hth
> > > >
> > > > --
> > > > Jack Leach
> > > > www.tristatemachine.com
> > > >
> > > > - "First, get your information. Then, you can distort it at your leisure."
> > > > - Mark Twain
> > > >
> > > >
> > > > "Rich K" wrote:
> > > >
> > > > > I'm automating the creation of windows folders from a stored procedure in an
> > > > > Access Module. I ask the user for a name for the folder after he's
> > > > > identified the location.
> > > > > What I'm looking for is code that varifies that the name is a valid windows
> > > > > folder name before I try to create it. Is there something built into vba for
> > > > > this purpose?
> > > > >
> > > > > Thanks.

 
Reply With Quote
 
dymondjack
Guest
Posts: n/a
 
      4th Mar 2009
Unfortunately I'm not sure how accurate that post is... only as good as the
guy posting it. Its seems well enough but don't know for sure. You could,
if you want, manually create a folder with a wrong char, and windows will
generally give you a blurb saying what characters can't be used in a
filename. You could double check those against the ones in the xtremevb post.

--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain


"Rich K" wrote:

> I think I just changed my mind and will use the first one.
> I had thought of that originally but figured I'd miss some charactors to
> evaluate.
>
> "dymondjack" wrote:
>
> > http://www.xtremevbtalk.com/showthread.php?t=207612
> >
> > Try that.
> >
> > The first response seems pretty good, the second one requires an added
> > reference, which I would not prefer.
> > --
> > Jack Leach
> > www.tristatemachine.com
> >
> > - "First, get your information. Then, you can distort it at your leisure."
> > - Mark Twain
> >
> >
> > "dymondjack" wrote:
> >
> > > Ah...
> > >
> > > I'm not sure about a vba function to validate a prospective folder name. I
> > > thought you meant to check for the existence of that folder first.
> > >
> > > I suppose an alternative would be to run the mkdir command, and before going
> > > much further, check to see if that directory now exists (using the Dir
> > > function). If it doesn't exist, obviously there was some error creating it,
> > > and you can abort your treeview process. For example, have a 'dummy' folder
> > > set up in your db location to perform this test before starting on the
> > > treeview.
> > >
> > > That would be the only way that I know off the top of my head, though it
> > > does seem as thought there would be an API to handle something like this.
> > > Probably there is, I just don't know of it.
> > >
> > > --
> > > Jack Leach
> > > www.tristatemachine.com
> > >
> > > - "First, get your information. Then, you can distort it at your leisure."
> > > - Mark Twain
> > >
> > >
> > > "Rich K" wrote:
> > >
> > > > Actually, the MkDir($Name) function is perfect for creating a folder with the
> > > > name $name.
> > > > What I'm looking for is a function that will varify if $Name is a valid
> > > > windows folder name before I pass it. I'm building the folders while
> > > > simultaneously building a tree view. I have to build the tree view first,
> > > > and then create the folder.
> > > >
> > > > If I can validate the folder name prior to the tree view, I can simple abort
> > > > the process, but if I have to wait until I try to create the folder to find
> > > > out if it can be created, I would have to roll back several functions.
> > > >
> > > > Thanks.
> > > >
> > > > "dymondjack" wrote:
> > > >
> > > > > Check out the Dir() function
> > > > >
> > > > > If you look at the help file, it will tell you how to use the arguments.
> > > > > One of them can be used for dealing with directories. I don't remember the
> > > > > syntax offhand, but if you should be able to pass the proposed name and the
> > > > > vbDirectory constant to check for the existance of the folder.
> > > > >
> > > > > hth
> > > > >
> > > > > --
> > > > > Jack Leach
> > > > > www.tristatemachine.com
> > > > >
> > > > > - "First, get your information. Then, you can distort it at your leisure."
> > > > > - Mark Twain
> > > > >
> > > > >
> > > > > "Rich K" wrote:
> > > > >
> > > > > > I'm automating the creation of windows folders from a stored procedure in an
> > > > > > Access Module. I ask the user for a name for the folder after he's
> > > > > > identified the location.
> > > > > > What I'm looking for is code that varifies that the name is a valid windows
> > > > > > folder name before I try to create it. Is there something built into vba for
> > > > > > this purpose?
> > > > > >
> > > > > > Thanks.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating new Personal folder with folders and sub folders Srini Microsoft Outlook Discussion 1 19th Aug 2009 09:15 AM
creating folders in Windows Mail =?Utf-8?B?S2l3aQ==?= Windows Vista Mail 2 5th Nov 2007 01:38 AM
Stop Windows creating these shared folders? nLinked Windows Vista Networking 0 27th Feb 2007 04:33 PM
Creating New Folders in Windows Explorer =?Utf-8?B?Q1NBbmRlcnNvbg==?= Windows XP Help 0 5th Nov 2004 12:50 AM
Creating Folders in Windows XP Fax Console JAD Windows XP Print / Fax 1 18th Sep 2003 09:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:52 PM.