Access12 getobject fails



I cannot open an instance of word from an Access 2007 database with the
following code. I've tried a repair of office and that has not fixed
the problem (I found references to this as a solution). I have all the
references set. This code only works if I have an instance of word
open. Any assistance is greatly appreciated.

On Error Resume Next
Set objWord = GetObject(, "Word.Application")
'An error indicates there was no Word instace open
' so we need to create a new Word Instance
If Err.Number = 429 Then
Set objWord = CreateObject("Word.Application")
'Set flag to indicate we created a New Word Instance
bolCreated = True
End If

'Enable Built in Error handling
On Error GoTo 0
'Show Word Instance
objWord.Visible = True
'Open selected File
Set doc = objWord.Documents.Open("filepath", False, True)

Tom van Stiphout

On Sun, 09 May 2010 15:01:24 -0700, "Dale" <[email protected]>

The code looks OK. Try running it on another machine. If CreateObject
does not work but GetObject does, you must have a really messed-up
installation of Office. I would uninstall and reinstall Office.

Microsoft Access MVP

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question