×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Close a Word Document from VB6.0

Close a Word Document from VB6.0

Close a Word Document from VB6.0

(OP)
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

RE: Close a Word Document from VB6.0

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

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:

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


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close