?
Solved

Run-time error'-2147023067 (80070725)': Automation Error

Posted on 2003-03-07
7
Medium Priority
?
196 Views
Last Modified: 2010-04-07
I am working on a VB application to invoke Ms Word from a form & am working on a windows XP SP1 machine. I have Ms Office 97 & MSWORD8.OLB on the same machine on which I am developing the application.

The application invokes Word absolutely fine & the required document as well when I am in the development Environment (Visual Studio).

Following is the code that I have used:

Dim wrd
Set Wrd = CreateObject("Word.Application")
Set newdoc = Wrd.Documents.Open("c:\abc.doc")


The problem,

Run-time error'-2147023067 (80070725)': Automation Error

comes when I am trying to run the application on Windows Me machines. Those machines also have MS Office 97.

I have created the Setup and have not included the MSWORD8.OLB in the setup package.

The following are the other controls that are in the pack:

comctl32.ocx
COMDLG32.OCX
TABCTL32.OCX
VB6 Runtime & OLE Automation

Could anybody tell me the possible reason be for the application to report this error?
0
Comment
Question by:dhirensharma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 8087552
Try add the M$ Word object library from your Reference first, then define the line:

Dim wrd as word.application
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 300 total points
ID: 8087864
I think it is a problem of dll versions, something that is called "Dll Hell".
Tha P&D Wizard has packing sensitive controls like comctl32.ocx
COMDLG32.OCX
which belongs to XP version of Windows and they are not "so compatible" with Me as we could wish.
0
 

Expert Comment

by:rengaraaj
ID: 8087886
The best way to open the word file through vb is simply use shell function

Try this
------------
command1_click()
Shell "c:\program files\microsoft office\office\winword.exe " & "c:\abc.doc", vbNormalFocusend sub
-------------------
Hope this will help u
rengards
Rengarajan
Software Engineer
CI.Com
0
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.

 

Author Comment

by:dhirensharma
ID: 8141621
Hi guys,

Thanks. I apologise for the long gap in this reply.
The problem really was with the Dlls (atleast that is what I concluded).
The word library was included right at the outset. The original problem:

Dim wrd
Set Wrd = CreateObject("Word.Application")
Set newdoc = Wrd.Documents.Open("c:\abc.doc")

hasn't been solved yet. I used:

Dim wrd as word.application
Set newdoc = wrd.Documents.Open("c:\legal\APA.doc")

as pointed out by ryancys. This worked.
Would appreciate if anybody could tell me the difference in the 2 methods.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 8143832
First use late-binding which means VB has no clue about what object you would create, it is slow and it carry out errors as you already know.
Second one is Early-binding which means that know need to set a reference to the used library in your project before use it. It is fastaer and you could catch errors at disign time and not when things are missed (like at run time)

It appears like XP doesn't like to create objects at run tme or maybe the lbary that gives CreateObject function is not available in target machine.
Try to use createObject with another object, just as a test, and see.
0
 

Expert Comment

by:CleanupPing
ID: 8900525
dhirensharma:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9074330
Moderator, my recommended disposition is:

    Split points between: ryancys and Richie_Simonetti

DanRollins -- EE database cleanup volunteer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month13 days, 4 hours left to enroll

777 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