*-- make sure form designer is open If ASelObj(laObj,1)=1 oForm = laObj[1] Else Messagebox("No form designer open.") Return EndIf *-- make sure object is a command group If ASelObj(laObj)=1 And Upper(laObj[1].BaseClass)="COMMANDGROUP" oGrp = laObj[1] Else MessageBox("No object selected or object is not a command group.") Return EndIf For Each oBtn In oGrp.Buttons *-- create new button on form with same name as button in group Store oBtn.Name To lcOldName, lcNewName lnCnt = 0 *-- no duplcate objects - tag a number to the end if it exists Do While Type("oForm."+lcNewName)="O" lnCnt = lnCnt + 1 lcNewName = lcOldName + Transform(lnCnt) EndDo oForm.NewObject(lcNewName, "commandbutton") oNew = oForm.&lcNewName *-- get pems for button * and set them for new button AMembers(laMem,oBtn,1) For ji = 1 To ALen(laMem,1) lcMem = laMem[ji,1] Do Case Case laMem[ji,2]="Property" If !PEMStat(oNew,lcMem,1) And !lcMem=="NAME" *-- not read-only, write to new button oNew.&lcMem = oBtn.&lcMem EndIf Case Inlist(laMem[ji,2],"Method","Event") lcCode =oBtn.ReadMethod(lcMem) If !Empty(lcCode) *-- have code, write it to the new button oNew.WriteMethod(lcMem, lcCode) EndIf EndCase EndFor EndFor