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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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.
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,715
Members
448,985
Latest member
chocbudda

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