I try to create a button on my spreadsheet with the following code
Dim btnSaver As Object
Set btnSaver = Workbooks(1).Worksheets("Results").OLEObjects.Add(ClassType:="Forms.CommandButton.1")
I also tried
Set btnSaver = Workbooks(1).Worksheets("Results").OLEObjects.Add("Forms.CommandButton.1")
I first get message can't enter break mode at this time and I press continue and get error application defined or object defined error - when I run it from excel (when I run it once again with debugger it says subscript out of range).
I've checked the code in another spreadsheet and it works (it says can't change vb project programmatically or sth like this but button is created nonetheless).