?
Solved

Open MSWord errors

Posted on 2002-06-12
6
Medium Priority
?
190 Views
Last Modified: 2010-05-02
I have been using the following code to open msword.

'Try to get word object - ie. Word is open
Set MSWdApp = GetObject (, "Word.Application")

'Can't create ActiveX object - ie. Word NOT open
If Err.Number = 429 Then                
   'clear error
   Err.Clear      

   'Create word object
   Set MSWdApp = CreateObject("Word.Application")
End If

However sometimes on a new machine or clean install the
CreateObject("Word.Application") will fail for a number of reasons.

Some machines will say error "7 out of memory" and others will say error "-2423... automation error".

On these machines where the CreateObject fails, GetObject(, "Word.Application") will work.

BTW. I must have the word object late bound.

Can anyone shed some light on why the
CreateObject("Word.Application") would fail?
0
Comment
Question by:finster
  • 3
  • 2
6 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 400 total points
ID: 7074713
Hi finster,

what happens when you use it like

Dim objWord As Word.Application

    On Error Resume Next

    Set objWord = GetObject(, "Word.Application")
    If Err.Number = 429 Then
        Err.Clear
        Set objWord = CreateObject("Word.Application")
        If Err.Number = 429 Then
            'error out, word is not installed OR setup correctly.
        Else
            'success, word object is created.
        End If
    Else
        'success, existing word object is referenced.
    End If

this is very confusing

>>Some machines will say error "7 out of memory" and others will say error "-2423... automation error".
>>On these machines where the CreateObject fails, GetObject(, "Word.Application") will work

but why would you use create object when you already had the object in the getobject, that's a flaw in your logic because if getobject did work assigning a new object to the object already instanced will give you all kind of errors

HAGD:O)Bruintje
0
 
LVL 5

Expert Comment

by:rpai
ID: 7075668
Please maintain your open questions.
Questions Asked 75
Last 10 Grades Given A A A A A A A A A A  
Question Grading Record 70 Answers Graded / 70 Answers Received
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7271002
A request has been made (http://www.experts-exchange.com/Community_Support/CleanUp/Q_20351863.html) to delete this question.

Experts: please leave your thoughts here. No response will mean that the deletion will be granted.

Netminder
CS Moderator
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 44

Expert Comment

by:bruintje
ID: 7273045
if the user wants to delete i want the solution we could eventually refund the points and move it to PAQ

but i don't spend thinkering on someone's problems especially when they're interesting to have them deleted with no feedback ;)
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7273519
bruintje,

I'm not terribly interested in deleting the question, and my natural disposition is to award the points if there's something close to a valid response. On the other hand, I'm no Expert in the subject, so I'm ready to believe you.

So: 1) PAQ/Refund? 2) PAQ/No Refund? 3) Award to XXX? 4) Delete?

Thanks,

Netminder
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7275950
Netminder thanks, give us 1

:O)Bruintje
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month15 days, 14 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question