-
Solved: Create new folder
I need to create a new folder in code based upon the first
5 characters of a newly created table omitting the three
characters tbl. Eg. So the new table is tblSuppliers. A new
folder on the hard disk would become c:\database\suppl and
so on.
Any help anyone greatly appreciated.
-
Here's a straightforward approach[VBA]Dim strFolderName As String
'initialize variable with table name
strFolderName = "tblSuppliers"
'trim off prefix
strFolderName = Right(strFolderName, Len(strFolderName) - 3)
'get first 5 letters
strFolderName = Left(strFolderName, 5)
'change drive and directory
ChDrive "C"
ChDir "c:\database"
'create directory
MkDir strFolderName[/VBA]You might want to look at using the FileSystemObject if you do any other file or folder manipulation - it has the added bonus of making it easy to check if files/folders exist
K :-)
-
create new folder
Well thanks for that Killian
I'll give that a try right now.
I'll keep you posted
-
jmentor, can we mark this solved?
-
Solved
Thank you.
Is it resolved
-
jmentor, you can mark threads solved that you started by using thread tools link at the top of this thread.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules