Access12 getobject fails

  • Thread starter Thread starter Dale
  • Start date Start date
D

Dale

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)
--
 
On Sun, 09 May 2010 15:01:24 -0700, "Dale" <[email protected]>
wrote:

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.

-Tom.
Microsoft Access MVP
 
Back
Top