View Single Post
  #2  
Old February 13th 08, 10:28 PM posted to microsoft.public.outlook.program_forms
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Outlook Script: How to create / delete txt file

You can use the VBA.FileSystem.Dir function to check for the existence of a
file and VBA.FileSystem.Kill to delete files.

Here's a sample for reading from a file:

Dim MyChar
Open "TESTFILE" For Input As #1 ' Open file for reading.
Do While Not EOF(1) ' Loop until end of file.
MyChar = Input(1, #1) ' Read next character of data.
Debug.Print Seek(1) ' Print byte position to the
' Immediate window.
Loop
Close #1 ' Close file.

The Microsoft Scripting Library has a FileSystemObject class that can also
be used for file operations.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"bbnimda" wrote:

Hi all,

I use custom form and I want to know how to manipulate simple file *.txt

I need 3 operations
1) check if xxx.txt exist
2) delete xxx.txt
3) save the content of listbox to xxx.txt

2nd step
load the content of xxx.txt to a listbox


tks
--



Ads