Problem with Form showing on ActiveDocument

M

MarieJ

Hi,
I have created a template with an autonew macro that shows a form (frm2) for
user input. If I fill out the user form and click OK, the info from the form
is placed in the document (Document1) in the appropriate bookmark locations.
If I leave the Document1 open, and attempt to use the template again to
create another document (Document2) from the same template, the form is
appearing in front of Document1 instead of Document2 which causes errors
because the bookmarks are no longer in Document1. To attempt to
troubleshoot, I have added code to detect the activedocument which I have
appear in a message box and that activedocument # is always correct, I
activate the activedocument, but when the form shows, it is again showing
over the previous document# and not the activedocument. Can anyone let me
know why that's happening and how to fix it?

Public Sub Autonew()
Dim strDoc As String
strDoc = ActiveDocument
MsgBox "Active Document is " & strDoc
Documents(strDoc).Activate
frm2.Show
End Sub

TIA! MarieJ
 
M

MarieJ

I have resolved the problem. I found code to unload all forms (there are 6
or 7 for this template) and that function solves the problem. I think a form
wasn't unloading. Thanks for reponding so quickly! Have a good day. MarieJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top