Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why can't open word file?

Status
Not open for further replies.

veeko

Programmer
Aug 29, 2012
2
NZ
Hi there

I got an odd issue to open word file.

codes like:
"
myoleobject = CREATE OLEObject
result = myoleobject.ConnectToNewObject("Word.Application")

IF result = 0 THEN
myoleobject.Visible = True
myoleobject.Documents.Open(as_letter_name,false,true,false)
"
It is always failed at 'calling external object function open at line #'

However, when I added debug messagebox between 2 myoleobject lines, it works fine, ie:

"
myoleobject = CREATE OLEObject
result = myoleobject.ConnectToNewObject("Word.Application")

IF result = 0 THEN
myoleobject.Visible = True
messagebox('debug', 'what')
myoleobject.Documents.Open(as_letter_name,false,true,false)
"
Why? Also how can I avoid user needs to click OK button on that debug messagebox to let the code keep running?

Many thanks for any suggest.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top