How to Create a Modeless Form VBA

wcm69

Board Regular
Joined
Dec 25, 2016
Messages
112
I have the below code in my workbook module and I'd like to make it modeless so I can work in the active spreadsheet while it is also active. I want it to also stay visible and active through out (i.e. as long as I'm in a particular spreadsheet) because I've put Command Buttons on the form to navigate between worksheets - of which there are 51.

I should mention the code I'm using positions the Form and hides the [x] Close button and Title bar.

Any help would be greatly appreciated.

Thanks in advance :)

Code being used:

Private Sub UserForm_Activate()

Me.StartUpPosition = 0
Me.Top = Application.Top + 170
Me.Left = Application.Left + Application.Width - Me.Width - 40

End Sub

Private Sub UserForm_Initialize()
HideTitleBar Me

End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
It sounds, from your description, that you are speaking about the UserForm itself ? Wanting it to be Modeless ?

That setting is in the Properties window in the VBE when you are viewing the User Form. Refer to this image :

HoWz827pLdS7s5hjTt3m9wsC6hDNQZ09tFXKHBnXE9B


Here's a link as well:

https://www.amazon.com/clouddrive/s...hDNQZ09tFXKHBnXE9B?ref_=cd_ph_share_link_copy
 
Upvote 0
It sounds, from your description, that you are speaking about the UserForm itself ? Wanting it to be Modeless ?

That setting is in the Properties window in the VBE when you are viewing the User Form.
You can also control this when you show the UserForm. The Show method for a UserForm has an optional argument whose default is vbModal... so show the UserForm as modeless, you would simply specify vbModeless for that second argument, like this...

UserForm1.Show vbModeless

where, of course, you would use the UserForm's actual name where I used UserForm1.
 
Last edited:
Upvote 0
You can open your UserForm like this:

Code:
UserForm1.Show Modeless

I would like to see your script which hides the title bar and "X"
 
Upvote 0
You can also control this when you show the UserForm. The Show method for a UserForm has an optional argument whose default is vbModal... so show the UserForm as modeless, you would simply specify vbModeless for that second argument, like this...

UserForm1.Show vbModeless

where, of course, you would use the UserForm's actual name where I used UserForm1.
You can open your UserForm like this:

Code:
UserForm1.Show Modeless
The vbModeless in my suggestion is a pre-defined variable in VB whose value is 0. Your suggestion of Modeless is a Variant variable created on the fly whose default Empty status is coerce to a value of 0 so that it can be used by the Show method. While Modeless may work on your setup, it will not work for anyone using Option Explicit like I do as that requires all variables to be declared before they can be used.



You can open your UserForm like this:
Code:
UserForm1.Show Modeless
I would like to see your script which hides the title bar and "X"
You might find the code I have in my mini-blog article here to be of some interest...

<!-- title / author block --> [h=3]Remove UserForm's TitleBar And Frame[/h]
 
Last edited:
Upvote 0
Deleted post. ........................
 
Last edited:
Upvote 0
Deleted post. ........................
Just so you know, besides being able to edit your message within the first 10 minutes after posting it, you also have the option of physically deleting it within that same time frame. So you could have done that instead of leaving a post saying you deleted whatever it is you originally wrote.
 
Last edited:
Upvote 0
You say I can delete this. Let me try. I have never seen a delete button. I always just enter "edit" when I want to delete my comment to a post.

I just tried to delete this but cannot.

Message Box says that comment is too short.
Please explain how we can delete a comment within 10 minutes. I see no delete button.
 
Last edited:
Upvote 0
You say I can delete this. Let me try. I have never seen a delete button. I always just enter "edit" when I want to delete my comment to a post.

I just tried to delete this but cannot.

Message Box says that comment is too short.
Please explain how we can delete a comment within 10 minutes. I see no delete button.
Click the Edit button. You will have one of two possibilities... either there will be a box at the top of the page with a Delete checkbox, which you must check, and a Delete button which you would press after checking the box. The other method that may be presented to you is a Delete button in line with the other buttons you would press it and, as I recall (I cannot see it right now and I do not remember what triggers its appearance) select a Delete option button and then press a OK or Delete button.
 
Last edited:
Upvote 0
Ok Let me try.

Well I still see none of the options you mentioned to delete a comment to a post within 10 minutes.

I'm Using Edge with Windows 10.

Maybe you can delete all these last postings about this to not get OP confused.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,942
Messages
6,181,900
Members
453,068
Latest member
DCD1872

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top