Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

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

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
dhirensharma
Asked:
dhirensharma
1 Solution
 
Ryan ChongCommented:
Try add the M$ Word object library from your Reference first, then define the line:

Dim wrd as word.application
0
 
Richie_SimonettiIT OperationsCommented:
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
 
rengaraajCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
dhirensharmaAuthor Commented:
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
 
Richie_SimonettiIT OperationsCommented:
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
 
CleanupPingCommented:
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
 
DanRollinsCommented:
Moderator, my recommended disposition is:

    Split points between: ryancys and Richie_Simonetti

DanRollins -- EE database cleanup volunteer
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now