بسم الله الرحمن الرحيم
اهلا بكم متابعى موقع عالم الاوفيس
درس من اهم الدروس فى دروات الاكسل vba ودروات اليوزرفورم حيث انى يجعل من عملك فية كثير من الاحترافية درس اليوم هو كيفية اخفاء الاطار الخارجى للفورم
كيف نقوم بهذا العمل
1- نقوم بفتح ملف عمل جديد
2- نقوم بادراج يورزفورم جديد
3- ندرج مديول جديد
ونكتب فى هذا الموديول هذا الكود (سيتم وضع الكود جاهز للتحميل برابط مباشر اسفل التدوينة )متتعبش نفسك فى الكتابة
Option Explicit
Private Declare Function FindWindow Lib "User32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
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 DrawMenuBar Lib "User32" ( _
ByVal hwnd As Long) As Long
Sub RemoveTitleBar(frm As Object)
Dim lStyle As Long
Dim hMenu As Long
Dim mhWndForm As Long
If Val(Application.Version) < 9 Then
mhWndForm = FindWindow("ThunderXFrame", frm.Caption) 'for Office 97 ver Else
mhWndForm = FindWindow("ThunderDFrame", frm.Caption) 'for office 2000 or above
End If
lStyle = GetWindowLong(mhWndForm, -16)
SetWindowLong mhWndForm, -16, lStyle
DrawMenuBar mhWndForm
End Sub
Private Declare Function FindWindow Lib "User32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
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 DrawMenuBar Lib "User32" ( _
ByVal hwnd As Long) As Long
Sub RemoveTitleBar(frm As Object)
Dim lStyle As Long
Dim hMenu As Long
Dim mhWndForm As Long
If Val(Application.Version) < 9 Then
mhWndForm = FindWindow("ThunderXFrame", frm.Caption) 'for Office 97 ver Else
mhWndForm = FindWindow("ThunderDFrame", frm.Caption) 'for office 2000 or above
End If
lStyle = GetWindowLong(mhWndForm, -16)
SetWindowLong mhWndForm, -16, lStyle
DrawMenuBar mhWndForm
End Sub
والان نترككم مع شرح الفيديو لمعرفة كيفية عمل الكود
لتحميل ملف العمل رابط مباشر على الميديا فاير من هنا
تعليقات: 0
إرسال تعليق