# Re: 救命呀

Posted by 小琳 on July 18, 1999 at 09:24:36:

In Reply to: 救命呀 posted by 煮面 on July 17, 1999 at 21:32:12:

: 小弟我写了一段程式去执行WORD(程式如下)
: 于程式第一次按 CMD 执行时一切正常
: 然后用手动的方式将WORD给结束掉，再给它按 CMD
: 但第二次按 CMD 就给它挂了(错误讯息为426..远端伺服器不存在或无法使用)
: (第二次，程式并未重新执行)
: 为什么?我已经给它试了好几天了说!照挂不勿
: 天啦........

: Option Explicit
: Private wordapp As Object
: Private wordDoc As Document

: Private Sub cmd_Click()
: Set wordapp = CreateObject("Word.Application")
: Set wordDoc = Documents.Open("c:\test.doc")
: wordapp.visible = True
: set wordapp = Nothing
: set wordDoc = Nothing
: End Sub

:::小女子将上面的程式改成如下:

Private wordapp As Word.Application
Private wordDoc As Word.Document

Private Sub command1_Click()
Set wordapp = CreateObject("Word.Application")
Set wordDoc = wordapp.Documents.Open("f:\其他\杂志.doc")
wordapp.Visible = True
Set wordapp = Nothing
Set wordDoc = Nothing
End Sub
希望能够解决您的问题!!!(正在吃泡面的小琳)

Follow Ups: