VBA MACRO写在记事本的下一行

时间:2016-11-29 06:36:01

标签: vba

我在如何使用vba宏写入记事本时遇到问题。 我想跟踪谁打开我的文件,包括文件打开的日期。

例如,我打开了我的报告。我的用户名应列在文本文件中。当USER_X打开此文件时。他的名字应该列在我的名字下面。当USER_Y打开此文件时,他的名字应列在USER_X下面。 注意:名称不应被覆盖。

任何帮助都将不胜感激。

谢谢, 约翰

1 个答案:

答案 0 :(得分:0)

代码如下所示

Sub WirteText()

Dim strFile_Path As String
strFile_Path = "C:\output.txt" 'Change as per your test folder and exiting file path to append it.
Open strFile_Path For Append As #1
Write #1, "This is my sample text"
Close #1

End Sub