create a Microsoft Access database

Posted on February 28th, 2009 in Visual Basic by admin

‘Add a reference to the Microsoft DAO 3.5 library

Private Sub Form_Load()
Dim ws As Workspace
Dim db As Database
Set ws = DBEngine.Workspaces(0)
Set db = ws.CreateDatabase(”test.mdb”, dbLangGeneral & “;pwd=Password”)
End Sub

Creates a file

Posted on February 27th, 2009 in Visual Basic by admin

Private Sub Form_Load()

Open “f:Test1.txt” For Output As #1
Write #1, “This is some sample text”
Write #1, “Programmershelp.co.uk”
Close #1

End Sub

create a text file

Posted on February 25th, 2009 in Visual Basic by admin

Private Sub Form_Load()

Dim objFSO As New FileSystemObject
Dim objFile As Object
Dim varString As Variant
varString = Array(”some”, “sample”, “text”)
Set objFSO = CreateObject(”Scripting.FileSystemobject”)
Set objFile = objFSO.CreateTextFile(”f:Test2.txt”)
objFile.WriteLine varString(0) & ” ” & varString(1) & ” ” & varString(2)
objFile.Close

End Sub

copy a text file

Posted on February 24th, 2009 in Visual Basic by admin

Private Sub Form_Load()

Dim objfso As New FileSystemObject
objfso.CopyFile “D:Test.txt”, “C:”

End Sub

Next Page »