By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,529 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,529 IT Pros & Developers. It's quick & easy.

Create Txt files & Organise

daniel aristidou
100+
P: 491
Hey...

I've got a program...that organises customers...
I want to create text files of each day........containing the IDs of customers seen........ However i want to organise the Text files in folders for each month...how should i go about creating the files and folders...?
Feb 1 '08 #1
Share this Question
Share on Google+
2 Replies


kadghar
Expert 100+
P: 1,295
Hey...

I've got a program...that organises customers...
I want to create text files of each day........containing the IDs of customers seen........ However i want to organise the Text files in folders for each month...how should i go about creating the files and folders...?
first of all, use smart names for the folders:

Jan2008, Feb2008, etc.. is a good idea.
use a function that creates the folder each time with an error handler, so if the folder already exists, it wont do anything.

so each time you generate a report:

Expand|Select|Wrap|Line Numbers
  1. dim path as string
  2. on error resume next
  3. mkdir "c:\yourpath\" & MonthFunction(month(date)) & Year(date) & "\"
  4. on error goto 0
  5. '[your code for creating the txt file and save it in Path]
Create a MonthFunction to write Jan, Feb, Mar... using Select Case.

I think that's the main idea. Use smart names for the files too, it'll save you a lot of time in the future.

HTH

[Edit]Note: how to create the txt file depends on the version, but using OPEN/ FOR/AS , then PRINT and then CLOSE, should do for most of the cases.[/edit]
Feb 1 '08 #2

daniel aristidou
100+
P: 491
Great thanks ill try it tonight
Feb 1 '08 #3

Post your reply

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