Em tìm trên mạng có đoạn code :
Sub writeFileExample2()
Dim fileName As String
Dim content As String
content = "Hello, Admin!" & vbCrLf & "Write data to text file example."
fileName = Application.ActiveWorkbook.Path & "\" & "ouput.txt"
' open file as output
Open fileName For Output As #1
' write content to file
Write #1, content
' close file
Close #1
End Sub
Nó mặc định là ở destop, bây giờ em muốn lưu ở ổ đĩa khác thì dùng hàm gì vậy. Em mới học ^^
Sub writeFileExample2()
Dim fileName As String
Dim content As String
content = "Hello, Admin!" & vbCrLf & "Write data to text file example."
fileName = Application.ActiveWorkbook.Path & "\" & "ouput.txt"
' open file as output
Open fileName For Output As #1
' write content to file
Write #1, content
' close file
Close #1
End Sub
Nó mặc định là ở destop, bây giờ em muốn lưu ở ổ đĩa khác thì dùng hàm gì vậy. Em mới học ^^