|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Nov 2007
Città: Trento
Messaggi: 198
|
[VBA] esecuzione codice per pulsante creato dinamicamente
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
__________________
home: CASE Fractal Design Define R3 CPU Intel Core i5 750 VENTOLA Arctic Cooling Freezer 7 Pro PWM Rev.2 MB Asus P7P55D Pro RAM 4 x 2GB DDR3 CORSAIR XMS3 VGA Asus EAH6850 DirectCU HD Seagate Constellation ES 1 TB + Western Digital Caviar Black 1 TB MONITOR Dell 2209WA S.O. Windows 7 Professional 64 bit ALI Corsair VX550 |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 20:35.



















