Predmet:Re:Nakon klika na excel file minimizirat i pokaze samo userform1
Ovaj kod stavi u neki modul. Otvori novi modul ako nemas.
PreuzmiIzvorni kôd (Visual Basic):#If VBA7 Then
Private Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare PtrSafe Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare PtrSafe Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal nMaxCount As Long) As Long
Private Declare PtrSafe Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, ByRef lpdwProcessId As Long) As Long
Private Declare PtrSafe Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
#Else
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, ByRef lpdwProcessId As Long) As Long
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
#End If
Const SW_MINIMIZE = 6
Private Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim windowTitle As String
Dim processId As Long
If IsWindowVisible(hwnd) Then
windowTitle = String$(256, Chr$(0))
GetWindowText hwnd, windowTitle, Len(windowTitle)
windowTitle = Left$(windowTitle, InStr(windowTitle, Chr$(0)) - 1)
If Len(windowTitle) > 0 Then
br = InStr(1, windowTitle, "Microsoft Visual Basic for Applications")
If br > 0 Then
ShowWindow hwnd, SW_MINIMIZE
Exit Function
End If
End If
End If
EnumWindowsProc = 1
End Function
Function Minimiziraj()
EnumWindows AddressOf EnumWindowsProc, 0
End Function
a ovo stavi u modul user form
PreuzmiIzvorni kôd (Visual Basic):Private Sub UserForm_Initialize()
Minimiziraj
End Sub
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.