PC Review


Reply
Thread Tools Rate Thread

Access12 getobject fails

 
 
Dale
Guest
Posts: n/a
 
      9th May 2010
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)
--

 
Reply With Quote
 
 
 
 
Tom van Stiphout
Guest
Posts: n/a
 
      10th May 2010
On Sun, 09 May 2010 15:01:24 -0700, "Dale" <(E-Mail Removed)>
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


>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)

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
getobject Brennan Microsoft Access 6 12th Jul 2008 02:20 AM
ASP.NET C# GetObject LamSoft Microsoft ASP .NET 4 6th Jun 2007 09:40 AM
GetObject Maxi Microsoft Excel Programming 0 14th Mar 2006 10:23 AM
Access12 Filips Benoit Microsoft Access ADP SQL Server 2 5th Mar 2006 05:01 AM
GetObject Michael Microsoft Excel Programming 3 16th Jun 2004 01:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:48 PM.