View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Create command button with VBA

Sub test()
Sheets("ALL LC PARTS").Delete
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = "ALL LC PARTS"

Set newbutton = ActiveSheet.OLEObjects.Add( _
ClassType:="Forms.CommandButton.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=227.25, _
Top:=219, _
Width:=72, _
Height:=24)
newbutton.Object.Caption = "Back"

End Sub


"Les" wrote:

Hi All, i have a report that i delete the old sheet and replace it with a new
one. What i would like to do is create a command button with VBA and place it
on the new sheet (ALL LC PARTS) and it must have a comment "BACK" on it the
code for this button would also have to go into the new sheet module.

Any help on this would be much appreciated.
--
Les