lock userform to screen

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,060
Hi All,

Is there a way to lock a userform to the screen so that if I go from say excel to internet explorer the userform will remain on the screen so that I can see the textbox info without having to flick back and forth between programs (I only use one monitor)

Thanks
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,060
Just a note,

I want it to be like a stickynotes program where it's locks/ pins the userform to the screen no matter what you do, until you close it.
 

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,060
Hi Guys,

Thanks for your help but maybe I need to explain what I want a bit better.

If you think of a post it note or sticky note, you write on it and stick in on your screen, it stays there.

I use an application called stickynotes, basically it is a computer post it note or stickynote.
You can write on it and it remains stuck to your screen no matter what application you go into, if you go into word the note is stuck there, if you go into internet explorer it is stuck there, until you close it.

A userform can stay on the screen when you switch between excel workbooks but when you change to internet explorer you can no longer see the userform, I want to be able to see the userform even when I switch from excel to internet explorer.

I hope that this explains what I am after a bit better.
 

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,060
Are there any experts out there that can help with this, please?????
 

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,060
Chip Pearson has given me a solution for this problem.

Code:
Option Explicit
Private Declare Function SetWindowPos Lib "user32" ( _
    ByVal hwnd As Long, _
    ByVal hWndInsertAfter As Long, _
    ByVal x As Long, _
    ByVal y As Long, _
    ByVal cx As Long, _
    ByVal cy As Long, _
    ByVal wFlags As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
Private Const HWND_TOPMOST = -1
Sub ShowTheForm()
    Dim UF As UserForm1
    Dim UFHandle As Long
    Set UF = New UserForm1
    UFHandle = FindWindow("ThunderDFrame", UF.Caption)
    SetWindowPos UFHandle, HWND_TOPMOST, UF.Left, UF.Top, UF.Width, UF.Height, 0&
    UF.Show vbModeless
End Sub

the only problem that I am having now is that I can not update the textbox controls on the form, hopefully Chip will give me a solution.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,651
Messages
5,838,579
Members
430,557
Latest member
MK15

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
Top