Is there a way to get my vba code in Access to wait until Microsoft Word has finished closing before it executes the next command?
I have set up some code to open up a Word file, fill in form data, convert the file to pdf, and then close down word. The problem is that I then need to open up a different word file and do the same thing with different data.
The issue is arising that while the first file is closing, the second one attempts to open up too quickly. I am getting an error message saying that normal.dot is already in use. Everything is fine if I build-in a timed delay in the code, but these timed delays can be unreliable.
Any idea how I can get my code to wait until the first instance of Word is closed before continuing? Alternatively, is there a way to perform the tasks with two open Word documents without them conflicting with one another?
Thanks!
I have set up some code to open up a Word file, fill in form data, convert the file to pdf, and then close down word. The problem is that I then need to open up a different word file and do the same thing with different data.
The issue is arising that while the first file is closing, the second one attempts to open up too quickly. I am getting an error message saying that normal.dot is already in use. Everything is fine if I build-in a timed delay in the code, but these timed delays can be unreliable.
Any idea how I can get my code to wait until the first instance of Word is closed before continuing? Alternatively, is there a way to perform the tasks with two open Word documents without them conflicting with one another?
Thanks!