Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-25-2020, 05:42 PM
Just Learning Just Learning is offline Show Userform hide active document only Windows 10 Show Userform hide active document only Office 2019
Novice
Show Userform hide active document only
 
Join Date: Mar 2020
Posts: 7
Just Learning is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 03-25-2020, 06:51 PM
Guessed's Avatar
Guessed Guessed is offline Show Userform hide active document only Windows 10 Show Userform hide active document only Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,567
Guessed is just really niceGuessed is just really niceGuessed is just really niceGuessed is just really niceGuessed is just really nice
Default

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
Reply With Quote
  #3  
Old 03-25-2020, 07:01 PM
Just Learning Just Learning is offline Show Userform hide active document only Windows 10 Show Userform hide active document only Office 2019
Novice
Show Userform hide active document only
 
Join Date: Mar 2020
Posts: 7
Just Learning is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 03-25-2020, 08:01 PM
Guessed's Avatar
Guessed Guessed is offline Show Userform hide active document only Windows 10 Show Userform hide active document only Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,567
Guessed is just really niceGuessed is just really niceGuessed is just really niceGuessed is just really niceGuessed is just really nice
Default

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
Reply With Quote
  #5  
Old 03-25-2020, 08:57 PM
Just Learning Just Learning is offline Show Userform hide active document only Windows 10 Show Userform hide active document only Office 2019
Novice
Show Userform hide active document only
 
Join Date: Mar 2020
Posts: 7
Just Learning is on a distinguished road
Default

Ok will give it a go.


Thanks
Reply With Quote
Reply

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 hide active document only 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 Userform hide active document only Show Hide info trintukaz Word 3 12-29-2011 12:23 AM
Show Userform hide active document only 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

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 11:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft