View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default how to keep the button visible always in the screen, thanks

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").Vis ible = 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

--
HTH. Best wishes Harald
Followup to newsgroup only please

"Kortrijker" skrev i melding
...
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