Word Exiting

okie20
04-28-2004, 02:00 PM
I do not really understand this error:
'Quit' is ambiguous across the inherited interfaces 'Word._Application' and 'Word.ApplicationEvents2_Event'.

I am programming an Office type test program that will do an event for Word when button1 is clicked, Excel when button2 is clicked. When I use the same syntax for word and excel, I get the error above for Word (obviously). The excel sub I have works perfectly fine. My Word sub is this:

VB:
Imports Word

Public Sub wordevents()
Dim oWordApps As New Word.Application()
Dim oWordDoc As Word.Document = oWordApps.Documents.Add()

oWordDoc.Activate() 'Do I need this?
Dim oWDRan As Word.Range
oWordDoc.Range.Delete()
oWDRan = oWordDoc.Range(0, 0)
With oWDRan
.InsertBefore("This is just a test")
.Font.Name = "Verdana"
.Font.Size = 16
.InsertParagraphAfter()
.InsertParagraphAfter()
.InsertAfter("HEHEHEHE")
End With

oWordDoc.SaveAs("c:\vb\wordtest.doc")

oWordApps.Documents.Close()
oWordApps.Quit() ' THIS IS THE LINE THAT GIVES THE ERROR

oWDRan = Nothing
oWordApps = Nothing
oWordDoc = Nothing

GC.Collect()
End Sub


Any help would be appreciated

okie

herilane
04-28-2004, 02:11 PM
MSDN article (http://msdn.microsoft.com/library/en-us/dnofftalk/html/office10032002.asp) - long article, you'll have to search for your error message to find the relevant section.

okie20
04-28-2004, 02:26 PM
thanks a bunch, that was the first time my code erred and it wasn't all my fault.

Rich_Tea_VB
04-28-2004, 03:05 PM
I dont get it :confused:
and im afraid of wasps and find that picture of someones quite disturbing :eek:
hey il get over it and could someone please tech me a thing or two about this VB im only a beginer :-\ thanx

Rich_Tea_VB
04-28-2004, 03:07 PM
"tech" i meant *teach*

herilane
04-28-2004, 03:09 PM
Rich_Tea_VB:
If you have a question, please start a new thread about it in a suitable forum. Please don't hijack other's threads. :)

Rich_Tea_VB
04-28-2004, 03:16 PM
Sorry im new :|

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum