Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2008

Tip: Looking for answers? Try searching our database.

Problem with Form showing on ActiveDocument

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MarieJ - 31 Jan 2008 15:28 GMT
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
David Sisson - 31 Jan 2008 15:44 GMT
Show us the code in the userform OK button event.
MarieJ - 31 Jan 2008 16:43 GMT
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

> Show us the code in the userform OK button event.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.