'---------------------------Macro to Create Text File-------------------------------'
Sub createtextfile()
Dim fso As New FileSystemObject
Dim txtfl As TextStream
'---------------------------Creating text file and writing---------------------------'
Set txtfl = fso.createtextfile(Environ("Userprofile") & "\Desktop\VBA Classs\Macro in Text File\createmacrofile.txt", True)
txtfl.Write "Created on:" & Now() & vbNewLine
txtfl.WriteLine "Macro Craeted by:" & Environ("UserName")
txtfl.WriteBlankLines (2)
txtfl.Write "Data Starts from here:-" & vbNewLine
txtfl.Close
End Sub
Sub createtextfile()
Dim fso As New FileSystemObject
Dim txtfl As TextStream
'---------------------------Creating text file and writing---------------------------'
Set txtfl = fso.createtextfile(Environ("Userprofile") & "\Desktop\VBA Classs\Macro in Text File\createmacrofile.txt", True)
txtfl.Write "Created on:" & Now() & vbNewLine
txtfl.WriteLine "Macro Craeted by:" & Environ("UserName")
txtfl.WriteBlankLines (2)
txtfl.Write "Data Starts from here:-" & vbNewLine
txtfl.Close
End Sub
No comments:
Post a Comment