gpt4 book ai didi

vba - 如何将 VBA Debug.Print 输出记录到文本文件?

转载 作者:行者123 更新时间:2023-12-02 07:31:55 29 4
gpt4 key购买 nike

Possible Duplicate:
Any way to automatically move contents of immediate window into a text file?

是否可以将 Debug.Print 输出记录到文本文件而不是 Excel VBA 中的立即窗口?

最佳答案

您应该看到 Jean-François Corbett 的精彩回答 here :

正如他所说,当您可以同时写入输出 txt 文件(或者只是 txt 文件,如果这是您想要的)时,写入立即窗口,然后复制并粘贴它没有什么意义。 .

他的回答示例:

Dim s As String
Dim n As Integer

n = FreeFile()
Open "C:\test.txt" For Output As #n

s = "Hello, world!"
Debug.Print s ' write to immediate
Print #n, s ' write to file

Close #n

关于vba - 如何将 VBA Debug.Print 输出记录到文本文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13853376/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com