Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    Continue script on document close

    Im using access to automate the majority of our documentation, the one im working on now will require the user select from a drop down box within.



    Im wondering what options I have for the user selecting the option, closing the document and then the script carrying on with the rest.

    Im thinking i could have a mesage box appear behind the docuement so when the user closes it they can click to carry on.. But is this possibe to do it on the close event of the docuement...

    the vba must be within access not the generated word docuement.

    any thoughts appreciated.

    Andy.

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    "Im wondering what options I have for the user selecting the option, closing the document and then the script carrying on with the rest." Rest of what?

    If the code has to be in Access, then we're talking Automation when it comes to controlling Office programs from other Office programs. If you want Access to control Word, then I don't get how you expect to affect a document if it's closed (beyond some of its inherent file properties) - or are you not saying that?

    Or are you expecting Access to control Word to some degree, then allow user to work with the Word document, then pass control back to Access? All the user has to do is minimize Word and click your waiting message or modal form and Access code will resume and the document gets modified by the user. That is asking for trouble. If you're going to automate as you mention in the beginning, then why allow the user to act on a Word document?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    "the rest of what" The rest of the script. whatever that may be.. in this case it adds the documents as attachements to an email.

    This word document can not have any automation on it at all. Its' a locked document and "
    will require the user select from a drop down box within." It's locked for a reason and I'm unable to change that. If I did change this document in anyway this would cause many errors to other processes beyond my control.

    "
    That is asking for trouble." this is why im asking the question.

    all I want to know is... can access detect words state somehow? Can it see the file is open and wait for it to be closed before continuing.

    Otherwise "asking for trouble" is the best solution I have.

    Thanks for any input, Andy./

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    AFAIK It can detect if the document is open or not but code cannot stop until it is not - unless you pass control to something that is modal. That would be a modal form or a message box as you have already stated. The problem with that is that code will resume if the modal object is closed, whether or not it should.

    What it could possibly do satisfactorily is loop until the document is not open, but I have to wonder what the performance would be. If I were to try that, I'd probably put about a 2 second timer on that check. I'd also ensure that the loop won't run unless the document has been opened. Since you're not using automation on the document, there's probably no way to know if the user did anything besides close it. If the user does not have to evaluate the document in order to decide what combo choice to make on that document, consider just having Access provide the choice and making the selection. In that regard, you could also display the document on an Access form in a linked object control. Then if there is room to make the view of the document large enough to see and make that decision, you could use that as the view for making the decision to alter the document field. However, I believe that the control can only show one document page and it would always be the first one.

  5. #5
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Interesting thoughts. I was actually trying to make the choices available in access as you sugested but there is no way I can do anything to the document.

    Its a request form from our client and I'm assuming they have their own programs that process the data we enter. It's totally locked down for me.

    The last "stage" is adding all the generated documents into an email as attachements with some default text and addresses populated. The user could still open the attachements if they realise they forgot something.

    So in this case Ill look into the loop thats a good idea. Otherwise ill see if I can somehow crack the document so i can also manipulate the same controls as they do.

    Thanks a lot.

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    If the doc is read only then how is it that you want to make a selection on a drop down field on it??

  7. #7
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    locked as in password protected. they have their own controls on the document. I can still edit the fields that are not locked.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Close word document that is not active.
    By Homegrownandy in forum Programming
    Replies: 1
    Last Post: 07-20-2018, 02:47 AM
  2. Is Document Close Method different in 2016?
    By Abacus1234 in forum Modules
    Replies: 0
    Last Post: 07-28-2016, 09:28 AM
  3. Replies: 3
    Last Post: 08-20-2015, 10:31 AM
  4. Replies: 5
    Last Post: 01-23-2014, 09:36 AM
  5. Replies: 1
    Last Post: 12-21-2005, 12:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums