Can I (somehow) have a command button which is stationary (at a given
position - on Workbook open) and remains Visible and available as I
activate to review different Worksheets? (a "floater" button)..
Thanks in Advance,
Can I (somehow) have a command button which is stationary (at a given
position - on Workbook open) and remains Visible and available as I
activate to review different Worksheets? (a "floater" button)..
Thanks in Advance,
you can make a separate toolbar for excel, which can float or you can attach to the other toolbars at top. You can make it visible upon opening, and then hide it before closing. The following will create this toolbar with two buttons that link to a macro
private sub workbook_open
goto skp
error1:
Call ButtonInstall
skp:
on error goto error1
Application.CommandBars("mybuttons").Visible = True
on error goto 0
end sub
private sub workbook_close
Application.CommandBars("mybuttons").Visible = false
end sub
sub ButtonInstall
Dim NewToolbar As Object
Dim NewButton As Object
Set NewToolbar = Application.CommandBars.Add(Name:="mybuttons", temporary:=False)
NewToolbar.Visible = True
Set NewButton = NewToolbar.Controls.Add(Type:=msoControlButton, ID:=2950)
With NewButton
.FaceId = 583
.OnAction = "Name of Macro1 here"
.Caption = "Macro1 description here"
End With
Set NewButton = NewToolbar.Controls.Add(Type:=msoControlButton, ID:=2950)
With NewButton
.FaceId = 45
.OnAction = "Name of Macro2 here"
.Caption = "Macro2 description here"
End With
End Sub
Thanks lcorey1;
Much appreciated
"lcoreyl" <[email protected]> wrote
in message news:[email protected]:
> YOU CAN MAKE A SEPARATE TOOLBAR FOR EXCEL, WHICH CAN FLOAT OR YOU CAN
> ATTACH TO THE OTHER TOOLBARS AT TOP. YOU CAN MAKE IT VISIBLE UPON
> OPENING, AND THEN HIDE IT BEFORE CLOSING. THE FOLLOWING WILL CREATE
> THIS TOOLBAR WITH TWO BUTTONS THAT LINK TO A MACRO
>
> private sub workbook_open
> goto skp
> error1:
> Call ButtonInstall
> skp:
> on error goto error1
> Application.CommandBars("mybuttons").Visible = True
> on error goto 0
> end sub
>
> private sub workbook_close
> Application.CommandBars("mybuttons").Visible = false
> end sub
>
> sub ButtonInstall
> Dim NewToolbar As Object
> Dim NewButton As Object
> Set NewToolbar = Application.CommandBars.Add(Name:="mybuttons",
> temporary:=False)
> NewToolbar.Visible = True
> Set NewButton = NewToolbar.Controls.Add(Type:=msoControlButton,
> ID:=2950)
> With NewButton
> .FaceId = 583
> .OnAction = "Name of Macro1 here"
> .Caption = "Macro1 description here"
> End With
> Set NewButton = NewToolbar.Controls.Add(Type:=msoControlButton,
> ID:=2950)
> With NewButton
> .FaceId = 45
> .OnAction = "Name of Macro2 here"
> .Caption = "Macro2 description here"
> End With
> End Sub
>
>
> --
> lcoreyl
> ------------------------------------------------------------------------
> lcoreyl's Profile: http://www.excelforum.com/member.php...fo&userid=2042
> View this thread: http://www.excelforum.com/showthread...hreadid=557584
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks