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

Close a Word Document from VB6.0

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
Hi!!!

I'm opening a Word Document with the next statement in Visual FoxPro 6.0:

RUN/N C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\WINWORD.EXE "C:\RHREPS\TEMP\RIESGOS.DOC"

After I opened this document, I can close it and come back to my program again..... I can do the same again, but.....

If I don't close my Word document (I'm using a table in word Document it has to be exclusive) when my program ask for that table... I get an error.....

Do you know how can I close a document with VisualFoxPro 6.0?

Any help I will appreciate it
Thanks a lot!!

CR
 
Well, here's what the VBA help for Word 10 gives as an example:

Code:
On Error GoTo errorHandler
ActiveDocument.Close _
    SaveChanges:=wdPromptToSaveChanges, _
    OriginalFormat:=wdPromptUser
errorHandler:
If Err = 4198 Then MsgBox "Document was not closed"

The syntax for the .close method is:

Code:
 expression.Close(SaveChanges, OriginalFormat, RouteDocument)

Of course you need to change the syntax slightly for VFP. BTW, the particular help file I'm referencing is VBAWD10. Just search for VBAWD* and you should be able to find it, whatever version of Word you have.

Dave Dardinger


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top