Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"distant server not responding" when openin a word file

Status
Not open for further replies.

MrBaRRon

Programmer
Aug 8, 2003
39
IT
Hi everybody,

I use this code to open a Word file from ACCESS:

Set wrd = CreateObject(Word.Application)
Wrd.visible = true
wrd.Documents.open "c:\test_vba\test_vba.doc"

It works well the first time, but when I close Word and the document and I click again on my button to execute the procedure, it show me this message error: " Distant server not responding error n° 462"

I don't understand why because when I retry just after , it works well. So It works one time on two.

Why ???

Thank U

 
Sorry but I have to say you that it's not the code that opens the file which not works but this one to modify the document:

Selection.Collapse Direction:=wdCollapseStart
Set Mytable = Activedocument.Tables.add(range:=Selection.range, Numrows:=5, Numcolumns:= 5)

It works one time but the time after not and the time after yes...

Thank U
 
And I guess you have some word processes in the task manager, as you have some implicit instantiation of words object.
e.g., replace this:
Selection.Collapse Direction:=wdCollapseStart
Set Mytable = Activedocument.Tables.add(range:=Selection.range, Numrows:=5, Numcolumns:= 5)
By this:
Wrd.Selection.Collapse Direction:=wdCollapseStart
Set Mytable = Wrd.Activedocument.Tables.Add(Range:=Wrd.Selection.Range, NumRows:=5, NumColumns:=5)
And so on ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
No It doesn't works anymore. Thank u guy and if u have another idea say it to me. ; )

 
Just post your code, from Set wrd = CreateObject to Set wrd = nothing.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top