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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE - Opening an MS Word - readonly

Status
Not open for further replies.

tinac99

Programmer
Jan 17, 2002
58
US
Hi,

I am using Powerbuilder 7.0.3. I want to open a word document in readonly mode to suppress this MS Word pop window:
-----
&quot;<Filename> is locked for editing&quot; with 3 buttons, namely, ReadOnly, Notify, and Cancel
-----

I have the following script:

oleobject ole_doc
ole_doc = create oleobject

ls_path = &quot;k:\mymessage.doc&quot;
ole_doc.ConnectToNewObject(&quot;word.application.8&quot;) = 0 THEN
ole_doc.application.Documents.Open(ls_path,False,True)
ole_doc.Visible = FALSE

Alternatively, I also tried the script:
ole_doc.documents.open(ls_path,false,true)

However which way, the MS Word popup message(indicated above) is still appearing.

Can anyone please tell me what else I'm missing?

Thanks.
 
Hi,

I have Word 97 SR-2 under NT 4.0

I try with :

Ole_doc.ConnectToNewObject(&quot;Word.Application&quot;)
Ole_doc.Application.Documents.Open(ls_path,false,true)

And It seems to work correctly,

I don't get the messageBox !

Which version of Word do you run, and under wich os ?

Do you have the same problem when you open the file directly in Word ?
(open File / choose the file to open / Commands and settings / Open Read-only)

Thierry
 
Thanks for replying.

I have Word 2000(9.0 SR-1) and it's running under Windows 2000. I tried replacing
ole_doc.ConnectToNewObject(&quot;word.application.8&quot;) with
ole_doc.ConnectToNewObject(&quot;word.application.9&quot;)
but it still works the same way.

I tried doing the script in macros and it works out ok.
I'm not sure I get what you want me to do...when I tried opening the file with another instance opened, a messagebox appears &quot;do you want to revert back to the saved <filename>?&quot;. Where can I get the commands and settings?
 
Hi,
What you can try is :

-Open Word
-Clic the open file button
-choose the file you want to open
-clic the &quot;Commands and Settings&quot; button
-choose &quot;Open Read-Only&quot;

The file is going to be open as read-only

In my version of Word, the &quot;Commands and Settings&quot; button
is the last button on the same row than the &quot;Look in&quot; field(the picture looks like a drop down with a red V)
(See &quot;Open&quot; in help, and &quot;Open a document&quot; and then &quot;Open a document as read-only&quot;)


This, to see if the problem is comming from Word or from the open function in PowerBuilder.

Bye

Thierry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top