View Full Version : Solved: Create new folder
jmentor
09-01-2005, 03:18 PM
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.
Killian
09-01-2005, 04:11 PM
Here's a straightforward approachDim 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 strFolderNameYou 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
jmentor
09-01-2005, 04:15 PM
Well thanks for that Killian
I'll give that a try right now.
I'll keep you posted
xCav8r
09-19-2005, 07:14 PM
jmentor, can we mark this solved?
jmentor
09-20-2005, 08:10 AM
Thank you.
Is it resolved
xCav8r
09-20-2005, 08:16 AM
jmentor, you can mark threads solved that you started by using thread tools link at the top of this thread. :)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.