#1
|
|||
|
|||
Show Userform hide active document only
Hi Everyone,
I have a document when opened brings up a userform. The userform can be closed by using the "X" button which allows the document to be modified. The cancel button that is on the userform closes the active document without saving it. Is there a way to show only the userform and hide the active document only or alternatively not allow any manual entries to the document? Many thanks |
#2
|
||||
|
||||
You could potentially minimise the document before showing the userform but it may be easier to code the form so that any actions other than clicking the one button you want results in the document closing or being locked. You haven't given us enough information to give you an exact answer.
What is the code that displays the userform? What is the code that runs when the user clicks the Cancel button? Is the code in the document itself or an attached template?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Hi Guessed,
Thanks for the suggestion. Here are the details - Private Sub Document_Open() UserForm1.Show End Sub -Private Sub CancelButton_Click() UserForm1.Hide ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges End Sub - The code is in the document only |
#4
|
||||
|
||||
OK, how about disabling the user's ability to click the X button on the userform?
Add this to the userform code module Code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then Cancel = True End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#5
|
|||
|
|||
Ok will give it a go.
Thanks |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to make userform and active document stand side by side | matapagi2019 | Word VBA | 1 | 03-12-2019 06:09 PM |
Show userform without losing document focus? Or other method to get a graphic to pop? | AlexR | Word VBA | 7 | 03-31-2013 12:17 PM |
Show Hide info | trintukaz | Word | 3 | 12-29-2011 12:23 AM |
VBA to show/hide tables | ccordner | Word VBA | 2 | 07-04-2011 03:00 AM |
VBA to show/hide tables | ccordner | Outlook | 0 | 07-01-2011 05:10 AM |