Lihat Gif Diatas..
Hallo Para Blogger,,bagaiman Kabarnya..? , Semoga Baik-Baik Saja. kali Ini Saya Akan Bahas Tentang Menu Starup " Bingung Mau Beri nama Apa,,Memang Ini hanya Buat Iseng-Iseng Saja ".hehehhehe
Langsung Aja Ke TKP.
1.Buka Visual Basic Dengan Menekan Tombol Alt F11..
2.Buat 2 Userform dengan Cara klik insert UserForm
3.Masukan Scrip Ini Pada UserForm1
'Kode Window API
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32.dll" (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 GetActiveWindow Lib "user32.dll" () 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 BringWindowToTop Lib "user32.dll" (ByVal hWnd As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Const GWL_STYLE = -16
Const WS_CAPTION = &HC00000
Const WS_SYSMENU = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2
Dim hWnd As Long
'Kode Berfungsi Untuk Membuat Userform Tampil Full Sesuai Layar Layar Laptop
Private Sub UserForm_Initialize()
Dim lngWindow As Long, lFrmHdl As Long
lFrmHdl = FindWindow(vbNullString, Me.Caption)
lngWindow = GetWindowLong(lFrmHdl, GWL_STYLE)
lngWindow = lngWindow And (Not WS_CAPTION)
Call SetWindowLong(lFrmHdl, GWL_STYLE, lngWindow)
Call DrawMenuBar(lFrmHdl)
End Sub
Private Sub UserForm_Activate()
Dim ufCaption As String
ufCaption = UserForm1.Caption
hWnd = FindWindow("ThunderDFrame", ufCaption)
With UserForm1
.Height = Application.Height
.Top = Application.Top
.Width = Application.Width
.Left = Application.Left
.BackColor = vbBlack
End With
Call code
MsgBox "Anda Akan Di Arahkan Ke Form Berikutnya ", , "http://exceltempo.blogspot.com/"
UserForm1.Hide
UserForm2.Show
End Sub
3. Selanjutnya Insert Module
Masukan Kode Berikut
Sub code()
Dim i As Integer, j As Integer, pctCompl As Single
Sheet1.Cells.Clear
For i = 1 To 100
For j = 1 To 200
Cells(i, 1).Value = j
Next j
pctCompl = i
progress pctCompl
Next i
With UserForm1
.BackColor = vbWhite
.Image2.Visible = True
.Image3.Visible = True
.Image4.Visible = True
.Label1.Visible = True
.Label2.Visible = True
.Image1.Visible = False
.Frame1.Visible = False
.Label5.Visible = False
.Label6.Visible = False
.Label7.Visible = False
End With
End Sub
Sub progress(pctCompl As Single)
UserForm1.Text.Caption = pctCompl & "% Loading..."
UserForm1.Bar.Width = pctCompl * 2
DoEvents
End Sub
4. Langkah Terakhir Memasukan Code berikut Pada Workbook.
Private Sub Workbook_Open()
On Error Resume Next
With Application
.VBE.MainWindow.Visible = False
.Visible = False
End With
UserForm1.Show
End Sub
Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
With Application
.Visible = True
.ThisWorkbook.Save
.DisplayAlerts = False
.Quit
End With
End Sub
"Kode Diatas Berfungsi Untuk Menyembunyikan Workbook.Ketika Excel Dibuka Yang Muncul Hanya Userform " Biasa Di Bilang Auto Open.
5. Simpan File Dengan Format Excel Macro-Enable Workbook..
Sekarang Coba Buka file Yang Anda Simpan..
0 komentar:
Posting Komentar