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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autotext problem accessed from VBA

Status
Not open for further replies.

Neme5is

Programmer
Joined
Sep 30, 2002
Messages
8
Location
NL
I have a problem using this bit of code the second time
It is being used to select an autotext in a .dot file and then using it in a .doc file..
The first time running the code is works perfectly, but the second time it generates an error:
can't find requested server..

this is the bit of code:
Set oWord = New Word.Application
With oWord
.Documents.Open (mFilePath & "Inventerra.dot")
.Documents.Open (mFilePath & mFileName)
.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
.Application.DisplayAutoCompleteTips = False

.Templates(mFilePath & "Inventerra.dot").AutoTextEntries.Item("Inventerra").Insert where _
:=Selection.Range, RichText:=True

.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
.Templates(mFilePath & "Inventerra.dot").AutoTextEntries("omlijning").Insert where _
:=Selection.Range, RichText:=True
End With

After this i close the activedocument (.doc) and the .dot file and then i close the Word application:
oWord.Quit
then i set the oWord object to nothing, but still it keeps giving me trouble saying it cant find the requested server... it does this at both of the .Templates methods...

MSWinword doesnt appear to stay open in the taskmanager, nor do any of the temp files in the folder appear to be present, i'm sorta lost here..

does any one know this problem and even better.. does anyone know an answer? :-)

many thanks in advance..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top