Tricky coding question

  • Thread starter Thread starter Dorian
  • Start date Start date
D

Dorian

I'm invoking MS Word from an Access form. The form contains a listbox which
lists the files in a folder.
When I invoke MS Word, the user is creating one of these files. When I exit
MS Word I want the listbox to refresh to show the created file.
How?
I tried the form Activate and GotFocus events and neither fire.
Is there any way to do this?
If I exit the fom and re-enter, the listbox refreshes.
Maybe in my MS Word autoclose macro I need to somehow tell Access to refresh
the form???
 
Dorian said:
I'm invoking MS Word from an Access form. The form contains a listbox
which
lists the files in a folder.
When I invoke MS Word, the user is creating one of these files. When I
exit
MS Word I want the listbox to refresh to show the created file.
How?
I tried the form Activate and GotFocus events and neither fire.
Is there any way to do this?
If I exit the fom and re-enter, the listbox refreshes.
Maybe in my MS Word autoclose macro I need to somehow tell Access to
refresh
the form???


The only thing I can think of is to re-run the code that populates your
list box
when you exit MS Word.

For example, I use the following code to populate a list box with text
files in
a certain folder (mstrPath):

Dim strFile

' Load file list into list box
strFile = Dir(mstrPath & "\*.txt")
lstFiles.RowSource = ""
While strFile <> ""
lstFiles.RowSource = lstFiles.RowSource & strFile & ";"
strFile = Dir
Wend

I normally run this in the form load to initially populate the list box.

You must have something similar in your form load event. So immediately
after the code you use to invoke MS Word, just replicate that code and
it will repopulate (refresh) the list box.


--
 
I don't know of a way to detect that Word has closed - maybe one of the true
experts here knows how to do that. My crappy way of handing it would be to
have a pop-up form displayed when the user wants to create a new doc. Force
the user to click a button on that form to create the doc, then have a close
button on that form that they click after they are done with Word. Then the
'On Activate' event would trigger when the original form is returned to.
Seems like there should be some way of knowing when Word is closed, though.
 
I don't know of a way to detect that Word has closed - maybe one of the true
experts here knows how to do that. My crappy way of handing it would be to
have a pop-up form displayed when the user wants to create a new doc. Force
the user to click a button on that form to create the doc, then have a close
button on that form that they click after they are done with Word. Then the
'On Activate' event would trigger when the original form is returned to.
Seems like there should be some way of knowing when Word is closed, though.

How about IsAppRunning?
http://www.mvps.org/access/api/api0007.htm
 
Back
Top