Results 1 to 2 of 2

Thread: Closing a hidden document

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2008
    Location
    Bromley, near London, UK
    Posts
    9

    Closing a hidden document

    This question relates to an Access .adp project (SQL Server 2000 back end) running under Access 2007 on windows xp.

    There's one place in the system where a recurring error message indicates that a copy of a specific word file is already open, so the active doc can't be saved to the specified name. (This is all happening programmatically.) Just to complicate matters, the already-open copy is hidden (i.e. .Visible = False) so the user's response to the error message is "oh no it isn't (open)".

    What I'd like to be able to do is, should that error arise, find that older copy, close it, then save the current active doc. But I can't figure out how to 'find' that doc so it can be closed.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Closing a hidden document

    you can use getobject("somedoc.doc") to attatch to the open instance of word then you can control the document, including close the document or quit its application
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width