Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.
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
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.