Trouble with export text in visual basic to .txt file
Posted on 2012-12-27
I've produced the following code:
Public Class background
Dim stRep As String
Dim strReport As String
Dim oFSO As Object
Dim objReport As Object
Private Sub MakeFile1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MakeFile1.Click
strReport = "report.txt"
stRep = InputBox(TextBox1.Text)
SetAttr(oFSO = CreateObject("Scripting.FileSystemObject"))
SetAttr(objReport = oFSO.CreateTextFile(strReport, True))
If oFSO.FolderExists(stRep) Then
For Each oF1 In oFSO.GetFolder(stRep).Files
Private Sub SetAttr(ByVal p1 As Object)
Throw New NotImplementedException
The goal is to create a .txt file and append it if it already exists. I'm working in VB 2010. However, the bolded line is giving me trouble. I've received the following message at runtime....
Operator '=' is not defined for 'Nothing' and type 'FileSystemObject'.
Any ideas on how to address this? I will keep doing research, but would appreciate feedback!