how to keep the button visible always in the screen, thanks

  • Thread starter Thread starter Kortrijker
  • Start date Start date
K

Kortrijker

Dear all,

Is there any way to keep a button, which is created in excel sheet , always
visible in the screen.

for instance, I create a button directly from toolbar/form/button in excel
sheet, I want to keep this button always stays in the fixed position
whereever I scroll this sheet. Can I realize it or it's impossible.

Thanks
JIANG
 
One way: Put the button within cell A1 and freeze panes at cell B2

For example:

Click on B2, then click Window > Freeze Panes

Widen col A & row1 large enough to accommodate the button within cell A1

Place the button within cell A1

It'll always stay in view whether you scroll down / to the right
 
Hi Jiang

Put it on a floating toolbar. See if this code get you started:

Sub MakeIt()
Call PromptMessage("Hi Jiang!")
End Sub
Sub PromptMessage(msgText As String)
Call KillIt
Application.CommandBars.Add(Name:="Messenger").Visible = True
Application.CommandBars("Messenger").Controls.Add _
Type:=msoControlButton
Application.CommandBars("Messenger").Top = 150
Application.CommandBars("Messenger").Left = 150
With Application.CommandBars("Messenger").Controls(1)
.Caption = msgText
.Style = msoButtonIconAndCaption
.FaceId = 608
.OnAction = ThisWorkbook.Name & "!KillIt"
End With
End Sub

Sub KillIt()
On Error Resume Next
Application.CommandBars("Messenger").Delete
End Sub
 
Jiang,

You could put the button at the top of the worksheet, and freeze below this
button (Window>Freeze Panes), or you could add the button to a toolbar.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Dear Max,
Dear Harald,
Dear Bob,

Thanks for your prompt reply. I think I could make it now.

best wishes
jiang
 
Back
Top