Hiding The "X" Or Close Button On A User Form
Mar 8, 2003I need to hide the "X" or close button on a user form so that users have to use the next or ok buttons that i have added.
View 9 RepliesI need to hide the "X" or close button on a user form so that users have to use the next or ok buttons that i have added.
View 9 Replieshow you can remove the close 'X' on the title bar of a user form please? I have used this for a password input box but if the user selects the 'X' on the title bar then it closes the password box without them having to enter a password and allows them into the workbook.
View 2 Replies View RelatedAssume that the workbook Book1.xls opens a user form named myUserForm.
I'm trying to show only the user form on the desktop when I open Book1.xls, with Book1.xls minimized on the Taskbar.
And , if the Cancel button on the form is clicked, then unload the form and close Book1.xls.
That simple!
In ThisWorkbook, I have the event:
Private Sub Workbook_Open()
ActiveWindow.WindowState = xlMinimized
ShowTheForm
End Sub
On the Form, I have the Cancel button:
Private Sub btnCancel_Click()
Unload Me
ThisWorkbook.Close True
End Sub
The above procedure shows the form, with Microsoft Excel blank window in the background, and produces a small bar at the bottom left of the screen for Book1.xls
Click the Cancel button, and both the Form and Book1.xls close, but the blank Excel window remain open !
I suppose I would not be able to edit this version of Book1.xls, but that is fine for now!
How do I define the variable in a text box so that it stays in that text box after the close of the dialog box. For example, I enter "Test" in TextBox1 then close UserForm1. I want to be able to open UserForm1 back up and still have the same user defined text in there.
View 9 Replies View RelatedIs there a way for me to save the values inside a userform to public variables when a user closes the form?
View 9 Replies View RelatedI have a userform, every time the user clicks on the start button it recodes there name, today’s date and their start time when they hit finish it records their end time.
The next time the user hits start it will record the users name, today’s date and start time on the next row (below their last entry)
The problem I have is that if the user clicks on start and then does not click on end button, but instead exits excel, then reopens the user form and hits start. The start will go on the row below, but now when they click on the end button the end time will go into the previous row for the end time, as they did not put it in if you know what I mean.
User NameDateStartEndTotal TimeTime InactiveClaire Watts
23/10/0915:04:2515:04:420:00:170:00:17Claire Watts
23/10/0915:04:4715:04:540:00:070:00:05Claire Watts
23/10/0915:04:5515:05:060:00:110:00:01Claire Watts
23/10/0915:05:0815:06:100:00:150:00:02Claire Watts
23/10/0915:05:55
#######Claire Watts
23/10/0915:06:18
15:06:18
I want to stop the user from being able to exit excel if they had clicked on start
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
MsgBox "You have clicked on Start and therefore mus Click the End button before you can exit excel.", vbCritical, "Cannot Close"
End Sub
This disables the X in the top right hand corner, I have aready disabled the one in the user form. However the following code does not let the user exit via File and Exit. Is there a way to put an IF statement into this that say if CmdStart has been clicked then the user can not exit, How every if it has not then they can exit.
I have read threads on this forum as well as on others and this does seam to be and issue.
OR is there a way of Hiding the X button that is in the top right hand corner. However this will still allows the user to hit start button and then exit excel, which will continue with the problem.
I have a useform that loads up with two buttons and I waat to force the user to chose one of the buttons. However, I have noticed that the user can just press the cross in the top right corner of the form to close the window and therefore not press either button.
Is there anyway I can stop the close form button working?
Is it possible to have a user form command button perform link or steps that are recorded with macro recorder? I am trying to reformat cut and paste a xls raw data file. I am trying to keep my file uploads to a min., but can upload an example if necessary.
View 4 Replies View RelatedI am not sure if this can be done or not. I am displaying a userform non-modally (Modeless). It will remain in place while the workbook is open. I know how to stop the form from being removed if the user clicks on the close box (the X in the top-righthand corner). What I would like is to stop the X displaying at all. I heard that it might be possible in the Properties box, but cannot see it in Excel 2000.
Even better would be if I could hide the entire header of the user form, so that I could simulate the look of placing controls within an Autoshape. (I am producing a project for users of Excel 2000 onwards, and I understand that placing controls directly in a worksheet can cause problems in other versions, so I must use forms.)
find the attached workbook
I have a Database and user form, in the user form i have a field named “Vehicle No” this is a combo box from which a user needs to select the Vehicle numbers, and all these are working fine now, I need your help in the following:
When user selects the second field named "Select Vendor name" i need a pop up window which shows all the Vehicles belongs to the vendor which they have selected, and with the popup window user selects the vehicle number then the Vehicle number combo box should be filled.
Currently users have to select by scrolling through Combo box which takes long time and difficult to find by scrolling.
I have a user form that has a combo box "City" two text boxes one called "Flight" and the other "Date". What I'm trying to do is to prevent the user from saving the data input from the user form if any of those three fields is left blank. The code that I have so far checks all of the required fields, if any are left blank a message notifys which field(s) is left blank and return the focus back to that field. But the rest of code also fires.
What I really need is either to stop the code if any fields are blank and return the focus back to the blank field, the user completes the field(s) and clicks the save again, or better yet, pause the code until all the required fields are completed and then complete the save. (There is actually another 200+ lines of code in this sub, but I deleted it to keep the post a little shorter.)
I have created a registration workbook for this year's youth sports league. All of the information is entered into a User Form and separated onto it's appropriate sheet designated by the child's age. Next year, I would like to use this year's workbook to look up returning players.
Will it be possible to add a "lookup" button into my form, or create a lookup program, that once the registrar clicks on the correct player, the information is plugged into the User Form, the registrar adjusts the age and any necessary info, presses enter, and the information is copied into the appropriate category in the new workbook? I haven't worked with User Forms long enough to know if they can be filled in that way, but if this can be done, you are the people who would know.
I'm using a series of user forms for data entry to a workbook, some of them open next stage user form on completion (OK cmd button).
All that is working fine, but I'd like the initial form to close on showing the next one. I've tried adding Unload and Hide commands following the frmInsertEntry.Show (Next stage form), to no avail, but I'd like this user form to close or hide at the end of the sub.
Private Sub cmdContinueType_Click()
ActiveWorkbook.Sheets("Records").Activate 'Select starting cell in record sheet
Range("N3").Select
Do
If IsEmpty(ActiveCell) = False Then ' Search for next empty cell
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
If optDrillType = True Then
frmDrillEntry.Show
Else
frmInsertEntry.Show
End If
End Sub
I need to know the command to close a workbook. I have used the information found here: http://www.ozgrid.com/VBA/userform-close.htm to disable closing the workbook via the upper right "X", but I need a button that, when clicked, simply closes the workbook instead.
View 2 Replies View RelatedI'm trying to pull up a second form from a command button within a form. There's a command button in a sheet to open the first form (frmOrderInput.) Then there's another command button in that form to open the second form (frmPriceInput.)
The Module to open the first is this:
I am useing a user Form
On the Form which I call my main menu, theres a help button, with this code
Private Sub cmdHelp_Click()
MsgBox ("Help file not ready yet, good luck on your own, Have a Nice Day!")
End Sub
For some reason when this is click, and after the user clicks ok on the msgbox, the frmmain, which this command is on, minimizes itself
I found this code and I liked to use it, however it does not close the form.
Private Sub cmdBtMain_Click()
frmMain.Show
frmFenster.Close
End Sub
This is probably really straight forward but cant see why it happens, the following macro works fine when called by a button created by the form toolbar but doesnt when called by a command button, get the runtime error 1004, "select method of range class failed"
ActiveSheet.Select
Range("B4:B37").Select
Selection.ClearContents
Range("G4:G37").Select
Selection.ClearContents
Range("B1").Select
Selection.ClearContents
Range("D1").Select
Selection.ClearContents
Range("F1").Select
Selection.ClearContents
Range("J1").Select
Selection.ClearContents
Range("M2:M3").Select
Selection.ClearContents
Range("B4").Select
ActiveWorkbook.Save
Application.Quit
Is there any easy way to disable the close (X) button at the top right of a form.
I've been trying...
Private Sub UserForm_Terminate()
UserForm1.Show
Unload UserForm2
End Sub
but i get a problem when re-opening the userform2??
I am imagining a spreadsheet with the equivalent of an info button in each cell of column A. The idea is the user clicks the button to open a User Form containing additional info about the entitity represented by values on that row.
E.g., Row 1 is labels, row 2 is all about Bob, 3 is about Jane, 4 is about Freddy. If the user clicks the info button on row 3 then a user form opens up and displays additonal info about Jane.
I am wondering if there is a way for VB to identify which row the clicked button was on without having to write individual code for each button telling VB which row the button was on.
I am hoping there is some form button property I can reference or interrogate which will give me a cell address; a button.position property or similar. This will obviously save me a lot of coding if VB can dynamically determine which row is being interrogated as there will be a couple of hundred of these to start with, potentially thousands. (I realise Access is a better solution for database interrogation, but I have to work with excel at present).
Ultimately, the user form that the button calls up will have a list box on it and I want the list box to default to the entity on that row, and allow the user to browse the other entities if they want to.
If there isn't a solution for this I will just have a single info button for the users to click that opens the user form and then they can select the entity from a list box. But I would like to offer the "intelligent display" option but don't relish coding the equivalent of several hundred "You clicked button four hundred and seventy six, default to info card for bert".
Is there a way to create a shortcut/button by hiding or showing a column? Example: I want to hide or show the whole column E by pressing a assign button or shortcut.
View 4 Replies View RelatedI have the following code that displays a form at a user defined time and if the user does not press "Stop" then the workbook saves and closes. The user can press stop then the workbook remains open.
Here is what I have where:
Admin_Auto_Shutdown = Yes or No
Admin_Auto_Shutdown_Time = 3:34pm or user defined time (This doesn't seem to work??)
'Auto Shutdown CloseandSave
If UCase(wb.Worksheets("Admin"). Range("Admin_Auto_Shutdown").Value) = "YES" Then
Application .OnTime TimeValue("Admin_Auto_Shutdown_Time"), "AutoShutdown"
End If
Sub AutoShutdown()
Application.OnTime TimeValue("Admin_Auto_Shutdown_Time"), "AutoShutdown"
Auto_Shutdown_Form.Show
End Sub
Now, my question is about a timer that I can show on a form. When the form is displayed I would like to give the user 30 seconds to press stop (and keep the workbook open) or to press proceed and save and close or to not do anything and the workbook would close and save when the timer reaches zero.
Code for user form which is missing most everything...
Private Sub Halt_Click()
'If user whats to continue without closing
Auto_Shutdown_Form.Hide
End Sub
Private Sub Proceed_Click()
'If user whats to save and close
Auto_Shutdown_Form.Hide
How do I add a timer to this code where it will run this at the end of the timer?
Auto_Shutdown_Form.Hide
Application.DisplayAlerts = False
With ThisWorkbook
.Saved = True
.Close
End With
I am trying to ask to the user to check if they logged out when they close the workbook but my code is not working...
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("OD&D Log-in").Select
If Range("H5") = "reconcile" Then
a = MsgBox("Do you want to Log-Out?", _
vbYesNo)
If a = vbNo Then Cancel = True
If a = vbYes Then
Sheets("OD&D Log-in").Select
Else
Workbooks("Daily OSD Log (ver5).xls").Close SaveChanges = True
End Sub
I have a workbook that has a macro that needs to run before it is closed. I have a button on my sheet that runs that macro and then closes the sheet. Is there a way that I can disable the "X" at the top right hand of the workbook and force the user to close the workbook via my button?
View 3 Replies View RelatedI have a macro that runs when the workbook opens. At the end of my macro I've added a Yes/No box. If 'No' the workbook closes without saving. If 'Yes' I would like to restart the macro. I can close it ok, but I don't know how to restart the macro from line 1 when 'Yes' is selected. Here is what I have:
YesNo = MsgBox("Done! Would you like to run again?", vbYesNo + vbCritical, "Caution")
Select Case YesNo
Case vbYes
'I don't know what to put here :(
Case vbNo
ActiveWorkbook.Close savechanges:=False
End Select
I am putting several buttons into my spread sheet and would prefer to use ActiveX controls rather than form controls. But I also need to hide the buttons from the end user (controls are to update data and will be used by the person who maintains the workbook). When I go to hide the columns, the ActiveX button doesn't hide with it. On the other hand, if I use a Form Control Button instead, it does indeed disappear when I hide the columns. Is there any way to get the ActiveX button to hide when hiding the columns?
View 9 Replies View RelatedI am using Excel 2003. I have created a workbook containing two sheets. The first sheet is designed as a form for our managers to complete. The fields they are required to complete are based on the selection they choose from a drop down field (set up through data validation).
I have created a command button which when you click it opens up the second sheet of the workbook asking you to complete the individuals work pattern. I am trying to hide this button so that it only appears when you select certain options from the drop down field.
I have looked back through posts on here and have tried adding the VBA code to the worksheet around commandbutton1.vissible = False in an IF statement but can't get this to work. A colleague has suggested that you can't hide command buttons because they are fixed items - is this the case.
Is there anyway to easily disable/dim the Excel Close (X) Button as I want to force my users to close an Excel workbook via a button?
View 9 Replies View RelatedI know how to add a save and close button but i do not know how to make it instantly available in every new workbook that i open. Currently i click the button and it looks for the macro in the first excel book that i created it in.
how do i make that macro become a default in every workbook?
i have a command button on a userform which closes the work book, i also want it to close xl. i have tried the following:
Private Sub CommandButton2_Click()
ThisWorkbook.Close
xl.close
End Sub