Combinar dos secuencias Userform Initialize
Me gustaría me indiquen como combinar dos instrucciones pues estoy intentando agregar los botones para maximizar y minimizar un formulario con lo siguiente:
Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Const WS_MINIMIZEBOX As Long = &H20000 Private Const WS_MAXIMIZEBOX As Long = &H10000 Private Const GWL_STYLE As Long = (-16)
Private Sub UserForm_Initialize() Dim lngMyHandle As Long, lngCurrentStyle As Long, lngNewStyle As Long If Application.Version < 9 Then lngMyHandle = FindWindow("THUNDERXFRAME", Me.Caption) Else lngMyHandle = FindWindow("THUNDERDFRAME", Me.Caption) End If lngCurrentStyle = GetWindowLong(lngMyHandle, GWL_STYLE) lngNewStyle = lngCurrentStyle Or WS_MINIMIZEBOX 'Or WS_MAXIMIZEBOX SetWindowLong lngMyHandle, GWL_STYLE, lngNewStyle End 'Sub
y otro que le da formato a un listbox
Private Sub UserForm_Initialize() For i = 1 To 4 Me.Controls("Label" & i) = Cells(1, i).Value Next i With ListBox1 .ColumnCount = 6 .ColumnWidths = "80 pt;80 pt;170 pt;1 pt;1 pt;1 pt" End With End Sub
2 Respuestas
Respuesta de Programar Excel
1
Respuesta de Dante Amor
1