KODE XML UNTUK MEMBUAT MENU DROP DOWN DI RIBBON EXCEL
Anda juga dapat mengunduh contoh file Menu Drop Down di Ribbon Excel.
Anda juga dapat mengunduh contoh file Menu Drop Down di Ribbon Excel.
Ada banyak jenis Menu DropDown di Microsoft Excel, salah satunya Menu Drop Down di Ribbon Excel yang bisa Anda buat dengan cara dibawah ini, Namun sebelum melanjutkan, silahkan luangkan waktu sepuluh menit untuk membaca dan melihat gambar secara cermat , karena ini akan sangat detail dan singkat.
Cara Dan Langkah-langkah
- Buka Microsft Excel
- Simpan dengan extensi Enable Macro (.xlsm)
- Buka Software Custom UI Editor, jika belum punya silahkan Download Software Custom UI Editor dan lakukan Cara Instal Software Custom UI Editor
- Setelah membuka software, silahkan klik > File > Open > pilih file yang sudah dibuat tadi > Open
- Klik kanan file dan pilih Office 2007 dan Office 2010 (lihat gambar)
- Silahkan salin Kode XML dibawah ini dan tempelkan di Office 2007
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<commands>
<command idMso="ApplicationOptionsDialog" enabled="false"/>
<command idMso="FileExit" enabled="false"/>
</commands>
<ribbon startFromScratch="true">
<tabs>
<tab id="customTab" label="DROP DOWN" insertAfterMso="TabHome">
<group id="customGroup1" label="Jenis Ke 1">
<menu id="MyDropdownMenu1" label="Kelas" size="normal" image="drop" >
<button id="a" label="Kelas 7" onAction="kelas7" image="down" />
<button id="b" label="Kelas 8" onAction="kelas8" image="down" />
<button id="c" label="Kelas 9" onAction="kelas9" image="down" />
</menu>
</group>
<group id="customGroup2" label="Jenis Ke 2">
<button id="d" label="Kelas 7" onAction="kelass7" imageMso="TextAlignGallery" />
<button id="e" label="Kelas 8" onAction="kelass8" imageMso="TextAlignGallery" />
<button id="f" label="Kelas 9" onAction="kelass9" imageMso="TextAlignGallery" />
</group>
<group id="customGroup3" label="Jenis Ke 3" image="drop" >
<button id="g" label="Kelas 7" onAction="kelasss7" image="down" />
<button id="h" label="Kelas 8" onAction="kelasss8" image="down" />
<button id="i" label="kelas 9" onAction="kelasss9" image="down" />
</group>
<group id="customGroup4" label="Jenis Ke 4">
<menu id="MyDropdownMenu2" size="large" image="drop" >
<button id="j" label="Kelas 7" onAction="kelassss7" image="down" />
<button id="k" label="Kelas 8" onAction="kelassss8" image="down" />
<button id="l" label="Kelas 9" onAction="kelassss9" image="down" />
</menu>
</group>
<group id="myGroupDD" label="Jenis Ke 5">
<dropDown id="dd1" label="Dropdown" getItemCount="DDItemCount" getItemLabel="DDListItem" onAction="DDOnAction"
getSelectedItemIndex="DDItemSelectedIndex"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
<commands>
<command idMso="ApplicationOptionsDialog" enabled="false"/>
<command idMso="FileExit" enabled="false"/>
</commands>
<ribbon startFromScratch="true">
<tabs>
<tab id="customTab" label="DROP DOWN" insertAfterMso="TabHome">
<group id="customGroup1" label="Jenis Ke 1">
<menu id="MyDropdownMenu1" label="Kelas" size="normal" image="drop" >
<button id="a" label="Kelas 7" onAction="kelas7" image="down" />
<button id="b" label="Kelas 8" onAction="kelas8" image="down" />
<button id="c" label="Kelas 9" onAction="kelas9" image="down" />
</menu>
</group>
<group id="customGroup2" label="Jenis Ke 2">
<button id="d" label="Kelas 7" onAction="kelass7" imageMso="TextAlignGallery" />
<button id="e" label="Kelas 8" onAction="kelass8" imageMso="TextAlignGallery" />
<button id="f" label="Kelas 9" onAction="kelass9" imageMso="TextAlignGallery" />
</group>
<group id="customGroup3" label="Jenis Ke 3" image="drop" >
<button id="g" label="Kelas 7" onAction="kelasss7" image="down" />
<button id="h" label="Kelas 8" onAction="kelasss8" image="down" />
<button id="i" label="kelas 9" onAction="kelasss9" image="down" />
</group>
<group id="customGroup4" label="Jenis Ke 4">
<menu id="MyDropdownMenu2" size="large" image="drop" >
<button id="j" label="Kelas 7" onAction="kelassss7" image="down" />
<button id="k" label="Kelas 8" onAction="kelassss8" image="down" />
<button id="l" label="Kelas 9" onAction="kelassss9" image="down" />
</menu>
</group>
<group id="myGroupDD" label="Jenis Ke 5">
<dropDown id="dd1" label="Dropdown" getItemCount="DDItemCount" getItemLabel="DDListItem" onAction="DDOnAction"
getSelectedItemIndex="DDItemSelectedIndex"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<commands>
<command idMso="ApplicationOptionsDialog" enabled="false"/>
<command idMso="FileExit" enabled="false"/>
</commands>
<ribbon startFromScratch="true">
<tabs>
<tab id="customTab" label="DROP DOWN" insertAfterMso="TabHome">
<group id="customGroup1" label="Jenis Ke 1">
<menu id="MyDropdownMenu1" label="Kelas" size="normal" image="drop" >
<button id="a" label="Kelas 7" onAction="kelas7" image="down" />
<button id="b" label="Kelas 8" onAction="kelas8" image="down" />
<button id="c" label="Kelas 9" onAction="kelas9" image="down" />
</menu>
</group>
<group id="customGroup2" label="Jenis Ke 2">
<button id="d" label="Kelas 7" onAction="kelass7" imageMso="TextAlignGallery" />
<button id="e" label="Kelas 8" onAction="kelass8" imageMso="TextAlignGallery" />
<button id="f" label="Kelas 9" onAction="kelass9" imageMso="TextAlignGallery" />
</group>
<group id="customGroup3" label="Jenis Ke 3" image="drop" >
<button id="g" label="Kelas 7" onAction="kelasss7" image="down" />
<button id="h" label="Kelas 8" onAction="kelasss8" image="down" />
<button id="i" label="kelas 9" onAction="kelasss9" image="down" />
</group>
<group id="customGroup4" label="Jenis Ke 4">
<menu id="MyDropdownMenu2" size="large" image="drop" >
<button id="j" label="Kelas 7" onAction="kelassss7" image="down" />
<button id="k" label="Kelas 8" onAction="kelassss8" image="down" />
<button id="l" label="Kelas 9" onAction="kelassss9" image="down" />
</menu>
</group>
<group id="myGroupDD" label="Jenis Ke 5">
<dropDown id="dd1" label="Dropdown" getItemCount="DDItemCount" getItemLabel="DDListItem" onAction="DDOnAction"
getSelectedItemIndex="DDItemSelectedIndex"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
<commands>
<command idMso="ApplicationOptionsDialog" enabled="false"/>
<command idMso="FileExit" enabled="false"/>
</commands>
<ribbon startFromScratch="true">
<tabs>
<tab id="customTab" label="DROP DOWN" insertAfterMso="TabHome">
<group id="customGroup1" label="Jenis Ke 1">
<menu id="MyDropdownMenu1" label="Kelas" size="normal" image="drop" >
<button id="a" label="Kelas 7" onAction="kelas7" image="down" />
<button id="b" label="Kelas 8" onAction="kelas8" image="down" />
<button id="c" label="Kelas 9" onAction="kelas9" image="down" />
</menu>
</group>
<group id="customGroup2" label="Jenis Ke 2">
<button id="d" label="Kelas 7" onAction="kelass7" imageMso="TextAlignGallery" />
<button id="e" label="Kelas 8" onAction="kelass8" imageMso="TextAlignGallery" />
<button id="f" label="Kelas 9" onAction="kelass9" imageMso="TextAlignGallery" />
</group>
<group id="customGroup3" label="Jenis Ke 3" image="drop" >
<button id="g" label="Kelas 7" onAction="kelasss7" image="down" />
<button id="h" label="Kelas 8" onAction="kelasss8" image="down" />
<button id="i" label="kelas 9" onAction="kelasss9" image="down" />
</group>
<group id="customGroup4" label="Jenis Ke 4">
<menu id="MyDropdownMenu2" size="large" image="drop" >
<button id="j" label="Kelas 7" onAction="kelassss7" image="down" />
<button id="k" label="Kelas 8" onAction="kelassss8" image="down" />
<button id="l" label="Kelas 9" onAction="kelassss9" image="down" />
</menu>
</group>
<group id="myGroupDD" label="Jenis Ke 5">
<dropDown id="dd1" label="Dropdown" getItemCount="DDItemCount" getItemLabel="DDListItem" onAction="DDOnAction"
getSelectedItemIndex="DDItemSelectedIndex"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
- Untuk mengecek apakah Kode XML sudah betul atau belum, silahkan klik Validate
- Jika Kode XMl sudah betul maka muncul pesan vbInformation seperti gambar dibawah ini
- Jika Kode XML salah maka muncul pesan vb Critical seperti gambar dibawah ini
- Langkah selanjutnya klik simpan dan silahkan keluar (close)
- Buka file excel yang sudah Anda buat tadi, dan jika Menu Ribbon sudah sama persis maka Anda sudah berhasil membuat Menu Drop Down di Ribbon Excel.
- Untuk selanjutnya tekan Alt+F11 maka Anda disajian dngan jendela Visual Basic for Application (VBA)
- Buat satu module dan salin Kode Macro dibawah ini
Dim ItemCount As Integer
Dim ListItemsRg As Range
Dim MySelectedItem As String
Sub DDItemCount(control As IRibbonControl, ByRef returnedVal)
With Sheet1.Range("A1:A3")
Set ListItemsRg = Range(.Cells(1), .Offset(.Rows.Count).End(xlUp))
ItemCount = ListItemsRg.Rows.Count
returnedVal = ItemCount
End With
End Sub
Sub DDListItem(control As IRibbonControl, index As Integer, ByRef returnedVal)
returnedVal = ListItemsRg.Cells(index + 1).Value
End Sub
Sub DDOnAction(control As IRibbonControl, ID As String, index As Integer)
MySelectedItem = ListItemsRg.Cells(index + 1).Value
End Sub
Sub DDItemSelectedIndex(control As IRibbonControl, ByRef returnedVal)
returnedVal = 0
MySelectedItem = ListItemsRg.Cells(1).Value
End Sub
Sub ValueSelectedItem(control As IRibbonControl)
MsgBox "The variable MySelectedItem have the value = " & MySelectedItem & vbNewLine & _
"You can use MySelectedItem in other code now to use the dropdown value"
End Sub
Dim ListItemsRg As Range
Dim MySelectedItem As String
Sub DDItemCount(control As IRibbonControl, ByRef returnedVal)
With Sheet1.Range("A1:A3")
Set ListItemsRg = Range(.Cells(1), .Offset(.Rows.Count).End(xlUp))
ItemCount = ListItemsRg.Rows.Count
returnedVal = ItemCount
End With
End Sub
Sub DDListItem(control As IRibbonControl, index As Integer, ByRef returnedVal)
returnedVal = ListItemsRg.Cells(index + 1).Value
End Sub
Sub DDOnAction(control As IRibbonControl, ID As String, index As Integer)
MySelectedItem = ListItemsRg.Cells(index + 1).Value
End Sub
Sub DDItemSelectedIndex(control As IRibbonControl, ByRef returnedVal)
returnedVal = 0
MySelectedItem = ListItemsRg.Cells(1).Value
End Sub
Sub ValueSelectedItem(control As IRibbonControl)
MsgBox "The variable MySelectedItem have the value = " & MySelectedItem & vbNewLine & _
"You can use MySelectedItem in other code now to use the dropdown value"
End Sub
- Simpan dan silahkan keluar (close)
Kesimpulan
Semua Kode XML harus diawali dengan Kode dibawah ini
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> (untuk Office 2007)
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> (untuk Office 2010)
Dan diakhiri dengan Kode XML dibawah ini
</tab>
</tabs>
</ribbon>
</customUI>
Tonton Video
Selain memberi artikel dan lampiran sampel file, kami juga memberikan tutorial video yang mungkin ini akan membantu Anda untuk mendapatkan hasil yang maksimal dari artikel ini. Tonton Video Disini.
Untuk keterangan dan kesimpulan lebih lanjut silahkan hubungi kami di kontak yang sudah tersedia.
"Kami Selalu Berusaha Memberikan Yang Terbaik Dan Original Untuk Anda"
Jabat Erat@Hak Cipta 2015
Post a Comment for "CARA MEMBUAT MENU DROP DOWN DI RIBBON EXCEL"