VBS获取所有已经打开的窗口,并输出到1.txt怎么写?
SetobjWord=CreateObject("Word.Application")objword.Visible=falseSetcolTasks=objWord.T...
Set objWord = CreateObject("Word.Application")
objword.Visible=false
Set colTasks = objWord.Tasks
For Each objTask in colTasks
If objTask.Visible Then
set fso=createobject("scripting.filesystemobject").opentextfile("1.txt",8)
fso.writeline colTasks
End If
Next
objWord.Quit
按这样写,运行时报错 展开
objword.Visible=false
Set colTasks = objWord.Tasks
For Each objTask in colTasks
If objTask.Visible Then
set fso=createobject("scripting.filesystemobject").opentextfile("1.txt",8)
fso.writeline colTasks
End If
Next
objWord.Quit
按这样写,运行时报错 展开
1个回答
展开全部
是不是类型不匹配?
那么fso.writeline colTasks改为fso.WriteLine objTask.Name
另外,最好是这么写
set fso=CreateObject("Scripting.FileSystemObject").OpenTextFile("1.txt",2,1)
Set objWord = CreateObject("Word.Application")
Set colTasks = objWord.Tasks
For Each objTask in colTasks
If objTask.Visible Then
fso.WriteLine objTask.Name
End If
Next
fso.close
objWord.Quit
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询