merhaba arkadaşlar yapmış olduğum userform makroları etkinleştirdiktensonra direk exceli kapatıp ekrana geliyor fakat comboboxda veriyi seçip okledikten sonra veriyi açmadan bekliyor formu kapatınca excel sayfası açılıyor benim demek istediğim form hep açık kalacak veriyi seçince açılacak bende minimize basıp aşağıda bekliyecek çok mu şey söledim acaba üstadların affına sığınarak kod aşağıdaki gibidir.
'Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex 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 SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetActiveWindow Lib "user32.dll" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const GWL_EXSTYLE = (-20)
Private Const HWND_TOP = 0
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_SHOWWINDOW = &H40
Private Const WS_EX_APPWINDOW = &H40000
Private Const GWL_STYLE = (-16)
Private Const WS_MINIMIZEBOX = &H20000
Private Const SWP_FRAMECHANGED = &H20
Private Const WM_SETICON = &H80
Private Const ICON_SMALL = 0&
Private Const ICON_BIG = 1&
Private Sub UserForm_Activate()
Dim hWnd As Long
hWnd = FindWindow(vbNullString, Me.Caption)
SetWindowLong hWnd, -16, GetWindowLong(hWnd, -16) Or &H10000 _
Or &H20000 Or &H40000
AddMinimiseButton
AppTasklist Me
End Sub
Private Sub AddMinimiseButton()
Dim hWnd As Long
hWnd = GetActiveWindow
Call SetWindowLong(hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE) Or WS_MINIMIZEBOX)
Call SetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE)
End Sub
Private Sub AppTasklist(myForm)
Dim WStyle As Long
Dim Result As Long
Dim hWnd As Long
hWnd = FindWindow(vbNullString, myForm.Caption)
WStyle = GetWindowLong(hWnd, GWL_EXSTYLE)
WStyle = WStyle Or WS_EX_APPWINDOW
Result = SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOACTIVATE Or SWP_HIDEWINDOW)
Result = SetWindowLong(hWnd, GWL_EXSTYLE, WStyle)
Result = SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOACTIVATE Or SWP_SHOWWINDOW)
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.Visible = True
End Sub
Private Sub UserForm_Initialize()
Dim ds, dc, f, s
Set ds = CreateObject("Scripting.FileSystemObject")
Set f = ds.GetFolder("d:\bütçeler")
Set dc = f.Files
For Each dosya In dc
cmdimalat.AddItem dosya.Name
Next
Call myfiles
End Sub
Private Sub myfiles()
Dim ds, dc, f, s
Set ds = CreateObject("Scripting.FileSystemObject")
Set f = ds.GetFolder("d:\bütçeler")
Set dc = f.Files
For Each dosya In dc
cmdkolleksiyon.AddItem dosya.Name
Next
Call myfiles2
End Sub
Private Sub myfiles2()
Dim ds, dc, f, s
Set ds = CreateObject("Scripting.FileSystemObject")
Set f = ds.GetFolder("d:\bütçeler")
Set dc = f.Files
For Each dosya In dc
cmdkapanan.AddItem dosya.Name
Next
End Sub
Private Sub CommandButton1_Click()
If cmdimalat.Value = "" Then Exit Sub
If Dir("d:\bütçeler\" & cmdimalat.Value) = "" Then
Else
Workbooks.Open ("d:\bütçeler\" & cmdimalat.Value)
End If
End Sub
Private Sub CommandButton2_Click()
If cmdkolleksiyon.Value = "" Then Exit Sub
If Dir("d:\bütçeler\" & cmdkolleksiyon.Value) = "" Then
Else
Workbooks.Open ("d:\bütçeler\" & cmdkolleksiyon.Value)
End If
End Sub
Private Sub CommandButton3_Click()
If cmdkapanan.Value = "" Then Exit Sub
If Dir("d:\bütçeler\" & cmdkapanan.Value) = "" Then
Else
Workbooks.Open ("d:\bütçeler\" & cmdkapanan.Value)
End If
End Sub
'Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex 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 SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetActiveWindow Lib "user32.dll" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const GWL_EXSTYLE = (-20)
Private Const HWND_TOP = 0
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_SHOWWINDOW = &H40
Private Const WS_EX_APPWINDOW = &H40000
Private Const GWL_STYLE = (-16)
Private Const WS_MINIMIZEBOX = &H20000
Private Const SWP_FRAMECHANGED = &H20
Private Const WM_SETICON = &H80
Private Const ICON_SMALL = 0&
Private Const ICON_BIG = 1&
Private Sub UserForm_Activate()
Dim hWnd As Long
hWnd = FindWindow(vbNullString, Me.Caption)
SetWindowLong hWnd, -16, GetWindowLong(hWnd, -16) Or &H10000 _
Or &H20000 Or &H40000
AddMinimiseButton
AppTasklist Me
End Sub
Private Sub AddMinimiseButton()
Dim hWnd As Long
hWnd = GetActiveWindow
Call SetWindowLong(hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE) Or WS_MINIMIZEBOX)
Call SetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE)
End Sub
Private Sub AppTasklist(myForm)
Dim WStyle As Long
Dim Result As Long
Dim hWnd As Long
hWnd = FindWindow(vbNullString, myForm.Caption)
WStyle = GetWindowLong(hWnd, GWL_EXSTYLE)
WStyle = WStyle Or WS_EX_APPWINDOW
Result = SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOACTIVATE Or SWP_HIDEWINDOW)
Result = SetWindowLong(hWnd, GWL_EXSTYLE, WStyle)
Result = SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOACTIVATE Or SWP_SHOWWINDOW)
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.Visible = True
End Sub
Private Sub UserForm_Initialize()
Dim ds, dc, f, s
Set ds = CreateObject("Scripting.FileSystemObject")
Set f = ds.GetFolder("d:\bütçeler")
Set dc = f.Files
For Each dosya In dc
cmdimalat.AddItem dosya.Name
Next
Call myfiles
End Sub
Private Sub myfiles()
Dim ds, dc, f, s
Set ds = CreateObject("Scripting.FileSystemObject")
Set f = ds.GetFolder("d:\bütçeler")
Set dc = f.Files
For Each dosya In dc
cmdkolleksiyon.AddItem dosya.Name
Next
Call myfiles2
End Sub
Private Sub myfiles2()
Dim ds, dc, f, s
Set ds = CreateObject("Scripting.FileSystemObject")
Set f = ds.GetFolder("d:\bütçeler")
Set dc = f.Files
For Each dosya In dc
cmdkapanan.AddItem dosya.Name
Next
End Sub
Private Sub CommandButton1_Click()
If cmdimalat.Value = "" Then Exit Sub
If Dir("d:\bütçeler\" & cmdimalat.Value) = "" Then
Else
Workbooks.Open ("d:\bütçeler\" & cmdimalat.Value)
End If
End Sub
Private Sub CommandButton2_Click()
If cmdkolleksiyon.Value = "" Then Exit Sub
If Dir("d:\bütçeler\" & cmdkolleksiyon.Value) = "" Then
Else
Workbooks.Open ("d:\bütçeler\" & cmdkolleksiyon.Value)
End If
End Sub
Private Sub CommandButton3_Click()
If cmdkapanan.Value = "" Then Exit Sub
If Dir("d:\bütçeler\" & cmdkapanan.Value) = "" Then
Else
Workbooks.Open ("d:\bütçeler\" & cmdkapanan.Value)
End If
End Sub