Reopening Word

J

Julie Mascara

I am using the following code to run a mail merge. I can
re-run a new merge fine provided I leave at least one
instance of word running; however if I close word
completly the process will not run. HELP

On Error Resume Next

Set objWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set objWord = CreateObject("Word.Application")
End If

objWord.Documents.Open FileName:=wordTagTemp
 
H

Harold Kless

Hi Julie,

When I run your code from Excel I get an error "ActiveX control can't create
Object".

If this is the same error that you are getting, it's most likely due to the
fact that the debug options are set to "break on all error"

To check this

1. in the Visual Basic Editor or if working from VB - open Tools ->
Options -> General

2. in the section "Error Trapping" set the option to be "Break on Unhandled
Errors"

Once I did that the code ran without a problem.

This article discussing Automating Word and may have some other information
that may be useful for you.

307216 WD2002: How to Use (OLE) Automation with Word

http://support.microsoft.com/?id=307216

Thanks,
--
Harold Kless, MCSD
Support Professional
Microsoft Technical Support for Business Applications
(e-mail address removed)

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
 

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

Top