Write data to text file

M

Marshall

I'm sure there code out some where on the Web. I just
haven't had any luck finding it.

I have separate Compose and Read pages on a custom form.
I am trying to create a CommandButton on the Read page
that will export the text within the form to a file on
the local C drive.
Thanks,
Marshall
 
H

Hollis D. Paul

I'm sure there code out some where on the Web. I just
haven't had any luck finding it
Look for sample code on www.slipstick.com or
http://www.outlookexchange.com/Articles/home/outlookcodeexample.asp

Also, the best place to find out how to write to a file is a beginning
book on using VB, since it is basically the same control. If you have
any VB projects set up, check with the VB help file on writing to a
text file.

Hollis D. Paul [MVP - Outlook]
(e-mail address removed)
Using Virtual Access 4.52 build 277 (32-bit), Windows 2000 build 2195
http://search.support.microsoft.com/kb/c.asp?FR=0&SD=TECH&LN=EN-US

Mukilteo, WA USA
 
S

Sue Mosher [MVP]

This is the most basic technique at its crudest:

Sub CommandButton1_Click()
Const olTxt = 0
Item.SaveAs "C:\" & Item.Subject & ".txt", olTxt
End Sub

Ideally, you would also want to clean any unpermitted characters from the file name, check for files with the same name, etc.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top