Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 11th, 2010, 08:59 PM
Registered User
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default detecting whether winword is running prior to attempting mail-merge

Greetings, I'm new here, and don't claim to know either Access or VBA that well.... I've beem researching a problem with a mail-merge function of the application:
- IF the merge process is started and WORD is already running, it fails.

Is it possible to determine programatically if word is running and error out gracefuly?

Research seems to indicate it should be possible.

BUT in fact attempting to execute found code samples either fails outright, or more consistently generates an ActiveX error:

Run-time error '429':
ActiveX component can't create object

Exploration on the error, (http://support.microsoft.com/kb/828550) doesn't appear to apply???
- checked the versions of the oleautomation files. all match.
- not attempting to CREATE anything, rather merely check existence...
Frustrating.
Sample failed code on button:

Code:
On Error Resume Next
MsgBox Str((GetObject(, "Word.Application"))) ' Triggers error
Dim oWordApp As Word.Application
Dim oDoc As Word.Documen

Set oApp = GetObject(, "Word.Application")
If Err Then
  MsgBox ("Word IS NOT RUNNING, or walking...")
Else
  MsgBox ("Word IS RUNNING")
End If
Any suggestions / hints / tips / pointers / moral support would be appreciated.

Thanks!
John





Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge Problem prasanta2expert Access VBA 2 April 26th, 2011 03:23 AM
mail merge from access dfisher BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 1 October 17th, 2008 08:09 PM
Mail Merge in Web aspBegineer83 ASP.NET 2.0 Basics 12 January 4th, 2008 06:00 PM
Need Help In Mail Merge raghur Access VBA 0 September 8th, 2005 05:46 AM
mail merge from query nabrown78 Access VBA 3 April 4th, 2005 08:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.