generate excel spredsheet with button
I would like to generate an excel spread sheet with c# that contain a button, and that I can handle th开发者_如何学Ce event when the user click on this button...
Any idea please...
Check this thread. It may be helpful. There is a lot of references to excel libs.
There's not much information to go on here, but my guess is that you need to do something similar to "create a button with macro from code module programmatically".
Basically, you will need to create the button and insert the vba linked to the button.
Also take note of the difference between a CommandButton and a FormsButton. The former already has an event attached to it. This is the same type of button as described in the link above. So if you create a button named called 'myVBAButton', the corresponding subroutine that it automatically linked to the click event would look like
Private Sub myVBAButton_Click()
End Sub
Remember, you still need to add the above code from your the code that creates the button.
精彩评论