I did find this snippet and too my surprise a command button was created.
Private Sub cmdJan14_Click() Worksheets("Jan14").Activate Worksheets("Jan14").Range("A1").Select End Sub
However, the subroutine needs to be added so I have that problem. Also, based upon the code above I need to modify specific properties. The properties of a command button would look like these:
Sub CreateButton() Dim Obj As Object Dim Code As String Sheets("Sheet1").Select 'create button Set Obj = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", _ Link:=False, DisplayAsIcon:=False, Left:=200, Top:=100, Width:=100, Height:=35) Obj.Name = "TestButton" 'buttonn text ActiveSheet.OLEObjects(1).Object.Caption = "Test Button" 'macro text Code = "Sub ButtonTest_Click()" & vbCrLf Code = Code & "Call Tester" & vbCrLf Code = Code & "End Sub" 'add macro at the end of the sheet module With ActiveWorkbook.VBProject.VBComponents(ActiveSheet.Name).CodeModule .insertlines .CountOfLines + 1, Code End With End Sub
|Can I reduce the fonts available by excel or visio for one project, but enable the full set of fonts for all other purposes?||8||35|
|ms office troubleshooting for users||8||36|
|Split a string in excel||9||34|
I need to trigger Application.WorksheetFunct
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
17 Experts available now in Live!