Visual Basic > Code Snippets
Open a file for writing to
Open a file for writing to Private Sub Form_Load() Dim objFso As New FileSystemObject Dim objFile As Object Set objFile = objFso.OpenTextFile("f:\Test.txt", ForWriting) objFile.Write "Hello World" objFile.Close End Sub Notes: Make sure you add a reference to the Microsoft Scripting library. Change the file and path to one which you will write to.
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows