I had created a program form searching use vba maro in excel, and that is work.
Than i was try open in OO calc. and save as to *ods. But isn't working... Any problems for writing code macro in oo. maybe not same.
Can u help me Please....!!!
Exampel 1. = this fungtions for hide button close in form (code macro in excel)
Code: Select all
Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Option Explicit
Private Const MF_BYPOSITION = &H400
Private Const MF_REMOVE = &H1000
Private Const WS_SYSMENU = &H80000
Private Const GWL_STYLE = (-16)
Private hwnd As Long
Private lStyle As Long
#If VBA7 And Win64 Then
Private Declare PtrSafe Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As LongLong
Private Declare PtrSafe Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long) As LongLong
Private Declare PtrSafe Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As LongLong
Private Declare PtrSafe Function DrawMenuBar Lib "user32" _
(ByVal hwnd As Long) As LongLong
Private Declare PtrSafe Function GetMenuItemCount Lib "user32" _
(ByVal hMenu As Long) As LongLong
Private Declare PtrSafe Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, _
ByVal bRevert As Long) As LongLong
Private Declare PtrSafe Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As LongLong
#Else
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
Private Declare Function GetMenuItemCount Lib "user32" _
(ByVal hMenu As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
#End If
Sub HideXCloseButton(oForm As Object)
hwnd = FindWindow("ThunderDFrame", oForm.Caption)
lStyle = GetWindowLong(hwnd, GWL_STYLE)
SetWindowLong hwnd, GWL_STYLE, lStyle And Not WS_SYSMENU
End Sub
Code: Select all
Private Sub UserForm_Activate()
hide_sheet
LBRESULT.ColumnCount = ThisWorkbook.Sheets("Tabel").[A1].CurrentRegion.Columns.Count
LBRESULT.ColumnWidths = "120;150;150;150;50;350;400;100"
Set RangeTabel = ThisWorkbook.Sheets("Tabel").[A1].CurrentRegion
Set RangeCopyTo = ThisWorkbook.Sheets("Dummy").[G1]
Set RangeKriteria = ThisWorkbook.Sheets("Dummy").[A1:A2]
End Sub
Code: Select all
Private Sub UserForm_Initialize()
With inisial
.AddItem "Nama Anggota"
.AddItem "Nama Pemilik Sertifikat"
.AddItem "Alamat Sertifikat"
.AddItem "Alamat Fisik"
End With
End Sub