In un foglio excel ho creato un form che al caricamento verifica i fogli presenti e crea un pulsante per ognuno di essi in base al seguente codice:
codice:
Private Sub UserForm_Initialize()
Dim obj_fogli As Object
Dim str_fogli As String
Dim bottone As Control
Dim int_btleft, int_bttop As Integer
int_btleft = 10
int_bttop = 75
Set obj_fogli = ActiveWorkbook.Sheets
With obj_fogli
For i = 1 To (.Count - 1)
Set bottone = Controls.Add("forms.CommandButton.1")
With bottone
.Name = Worksheets(i).Name
.Width = 175
.Height = 20
.Caption = Worksheets(i).Name
.Top = int_bttop
.Left = int_btleft
End With
int_bttop = int_bttop + 25
str_fogli = i
Next
End With
End Sub
Ora, quando si preme il pulsante, devo far eseguire una routine che mi apre un altro form ma non sono riuscito a farlo :muro: qualcuno ha suggerimenti?