Article ID: 131847
Article Last Modified on 10/11/2006
' This Sub procedure should be called on the last line of your original
' Sub procedure.
Sub First_Half()
' Create a toolbar.
Toolbars.Add "resume"
' Add the button to the toolbar.
' Note that if you are using Microsoft Excel version 5.0,
' comment out the "StatusBar:" argument of the Add method and remove
' the comma and line-continuation character after "Enabled:=True"
Toolbars("resume").ToolbarButtons.Add Button:=102, _
OnAction:="Second_Half", Pushed:=False, Enabled:=True, _
StatusBar:="Click here to resume macro"
' Name the button.
Toolbars("resume").ToolbarButtons(1).Name = "Resume Macro"
' Make sure the bar is not docked.
Toolbars("resume").Position = xlFloating
' Position the bar midway between the left and right of the window.
Toolbars("resume").Left = _
(ActiveWindow.Width + Toolbars("resume").Width)/ 2
' Position the bar midway between the top and bottom of the window.
Toolbars("resume").Top = _
(ActiveWindow.Height + Toolbars("resume").height)/ 2
' Make sure the bar is showing.
Toolbars("resume").Visible = True
End Sub
Sub Second_Half()
' Delete the toolbar.
Toolbars("resume").Delete
' Insert the name of the second half of your procedure in place of
' this message box.
'
' NOTE: Any variables dimensioned in the first half of your
' procedure may lose their values before this sub procedure is
' executed. You will need to be certain any variables used by the
' procedure you name in place of this message box are dimensioned at
' the Module level.
MsgBox "after"
End Sub
Additional query words: XL
Keywords: kbcode kbhowto kbprogramming KB131847