TA的每日心情 | 开心 2016-4-27 10:20 |
---|
签到天数: 9 天 连续签到: 1 天 [LV.3]测试连长
|
5#
楼主 |
发表于 2016-4-19 16:55:31
|
只看该作者
EditWordtext "C:\Unified Functional Testing\Results\Test.doc","Step1: check input value is right"
Function EditWordtext (filepath,content)
Set fso = CreateObject("Scripting.FileSystemObject")
Set oWord = CreateObject("Word.Application")
Set WshShell = CreateObject("WScript.Shell")
oWord.displayAlerts=false
oWord.visible=False
If not (fso.FileExists(filepath)) Then
Set oWordDoc=oWord.Documents.Add
oWordDoc.SaveAs filepath
End If
Set oWordDoc=GetObject(filepath)
oWord.documents.open filepath,ForAppending,True
Set oDoc=oWord.ActiveDocument
Set oRange=oDoc.content
oRange.insertafter content
WshShell.SendKeys"{ENTER}"
wait(1)
oWord.ActiveDocument.Save
oWord.Application.Quit True
Set oRange=Nothing
Set oDoc=Nothing
Set oWord=Nothing
End Function
一样的问题,运行到save那步的时候,不能直接保存要另存到某处。显示文件是read only的
要崩溃了。怎么弄呀 |
|