VBA runtime error 424

labonte373

Registered User.
Local time
Yesterday, 21:03
Joined
Jul 23, 2007
Messages
12
I am try to add a word writer form to my db. I keep getting runtime error 424 object required.

Here is the code:

Option Compare Database

Private Sub cmdCreate_Click()
' Copy the text to a Word document
Dim objWord As Word.Application

' Instantiate Word and a new document
Set objWord = New Word.Application
objWord.Documents.Add

' Insert the text after the default range,
' which is the start of the document
objWord.ActiveDocument.Range.InsertAfter (txtText.Value)

' Save the file
objWord.ActiveDocument.SaveAs (txtFileName.Value) ' And show it
objWord.Visible = True
End Sub

Sub EarlyBinding()
'use word as automation server
Dim objWord As Word.Application
Set objWord = New Word.Application
objWord.Visible = True
objWord.Quit

End Sub


Can someone explain this to me?
 

Users who are viewing this thread

Back
Top Bottom