A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook Script: How to create / delete txt file



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 13th 08, 03:32 PM posted to microsoft.public.outlook.program_forms
bbnimda
external usenet poster
 
Posts: 94
Default Outlook Script: How to create / delete txt file

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
--


  #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
--



  #3  
Old February 14th 08, 10:17 AM posted to microsoft.public.outlook.program_forms
bbnimda
external usenet poster
 
Posts: 94
Default Outlook Script: How to create / delete txt file

It doesnt work

but I tryed FileSystemObject and found the way to Check if file exist
and delete it

here is my code
Set objFSO = CreateObject("Scripting.FileSystemObject")
if objfso.FileExists("C:\FSO\FileT.txt") then
objfso.DeleteFile "C:\FSO\FileT.txt"
else
.....
.....
.....
end if

But I still looking for a way to Create a new file and fill it and Save
it



"Eric Legault [MVP - Outlook]" a écrit dans
le message de news: ...
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
--





  #4  
Old February 14th 08, 04:23 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

Did you change "TESTFILE" to a valid file path?

You can also create a file with the FileSystemObject:

Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile("c:\testfile.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close

--
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:

It doesnt work

but I tryed FileSystemObject and found the way to Check if file exist
and delete it

here is my code
Set objFSO = CreateObject("Scripting.FileSystemObject")
if objfso.FileExists("C:\FSO\FileT.txt") then
objfso.DeleteFile "C:\FSO\FileT.txt"
else
.....
.....
.....
end if

But I still looking for a way to Create a new file and fill it and Save
it



"Eric Legault [MVP - Outlook]" a écrit dans
le message de news: ...
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
--






  #5  
Old February 14th 08, 04:57 PM posted to microsoft.public.outlook.program_forms
bbnimda
external usenet poster
 
Posts: 94
Default Outlook Script: How to create / delete txt file

Yes I all ready found "CreateTextFile" but still was looking for the way
to fill the file ( tks for Writeline )

Ok now I know how to create , fill and save a text file

Now I have to open an existing text file and get data from this file

Tks for help




"Eric Legault [MVP - Outlook]" a écrit dans
le message de news: ...
Did you change "TESTFILE" to a valid file path?

You can also create a file with the FileSystemObject:

Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile("c:\testfile.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close

--
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:

It doesnt work

but I tryed FileSystemObject and found the way to Check if file exist
and delete it

here is my code
Set objFSO = CreateObject("Scripting.FileSystemObject")
if objfso.FileExists("C:\FSO\FileT.txt") then
objfso.DeleteFile "C:\FSO\FileT.txt"
else
.....
.....
.....
end if

But I still looking for a way to Create a new file and fill it and
Save
it



"Eric Legault [MVP - Outlook]" a écrit
dans
le message de news: ...
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
--








  #6  
Old February 14th 08, 05:12 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

This might come in handy:

VBScript Language Reference:
http://msdn2.microsoft.com/en-us/library/d1wf56tt.aspx

--
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:

Yes I all ready found "CreateTextFile" but still was looking for the way
to fill the file ( tks for Writeline )

Ok now I know how to create , fill and save a text file

Now I have to open an existing text file and get data from this file

Tks for help




"Eric Legault [MVP - Outlook]" a écrit dans
le message de news: ...
Did you change "TESTFILE" to a valid file path?

You can also create a file with the FileSystemObject:

Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile("c:\testfile.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close

--
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:

It doesnt work

but I tryed FileSystemObject and found the way to Check if file exist
and delete it

here is my code
Set objFSO = CreateObject("Scripting.FileSystemObject")
if objfso.FileExists("C:\FSO\FileT.txt") then
objfso.DeleteFile "C:\FSO\FileT.txt"
else
.....
.....
.....
end if

But I still looking for a way to Create a new file and fill it and
Save
it



"Eric Legault [MVP - Outlook]" a écrit
dans
le message de news: ...
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
--









 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
need a script to delete contact list in Outlook 2003 JohnW Outlook - Using Contacts 2 July 24th 07 02:40 PM
Create Folder in Outlook 2003 with GPO or script? kc2kth Outlook - Installation 1 March 29th 07 01:05 AM
Create IMAP account in Outlook using Logon Script Karnifexx Outlook - General Queries 1 January 24th 07 02:18 PM
Outlk 2k3 Script: Saving Excel File programticaly from OUTLOOK SCRIPT news.microsoft.com Outlook and VBA 3 November 22nd 06 04:33 PM
Outlook 2003 Script: How to create an Id for task news.microsoft.com Outlook and VBA 6 October 20th 06 11:16 PM


All times are GMT +1. The time now is 11:41 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.