Berikut saya kirim kan source di general modulnya




Mohon penjelasannya,trim’s





Option Explicit


Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _


"GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long


Private Type OPENFILENAME


lStructSize As Long


hwndOwner As Long


hInstance As Long


lpstrFilter As String


lpstrCustomFilter As String



nMaxCustFilter As Long


nFilterIndex As Long


lpstrFile As String


nMaxFile As Long


lpstrFileTitle As String


nMaxFileTitle As Long


lpstrInitialDir As String


lpstrTitle As String


flags As Long


nFileOffset As Integer


nFileExtension As Integer


lpstrDefExt As String


lCustData As Long


lpfnHook As Long


lpTemplateName As String


End Type











Function GetFile(Hwnd As Long) As String


Dim OFName As OPENFILENAME


OFName.lStructSize = Len(OFName)


OFName.hwndOwner = Hwnd


OFName.hInstance = App.hInstance



OFName.lpstrFilter = "Ms Ofice97/XP/2003(*.doc;*.xls)" _


+ Chr$(0) + "*.doc;*.xls" + Chr$(0) _


+ "Kabeh File (*.*)" + Chr$(0) + "*.*" + Chr$(0)


OFName.lpstrFile = Space$(254)


OFName.nMaxFile = 255


OFName.lpstrFileTitle = Space$(254)


OFName.nMaxFileTitle = 255


OFName.lpstrInitialDir = "C:\"


OFName.lpstrTitle = "Open File - vbBego Team 2000?"


OFName.flags = 0


If GetOpenFileName(OFName) Then


GetFile = Left(OFName.lpstrFile, _


InStr(1, OFName.lpstrFile, Chr(0)) - 1)


Else


GetFile = ""


End If


End Function





From: [email protected] [mailto:[email protected]]
Sent: Wednesday, June 18, 2014 7:09 PM
To: [email protected]
Subject: RE: [belajar-excel] getfile








Sepertinya butuh bunyi script (min deklarasi nya) prosedur bernama getfile. Klo 
ndak ada di module object sheet tersebut, mungkin di sebuah general module yg 
ada di file tersebut.


On Jun 18, 2014 5:58 PM, "'irianto' [email protected] [belajar-excel]" 
<[email protected]> wrote:





Betul mr kid kayaknya seperti itu ,source ini adalah bagian dari source u/buka 
pass macro,logika nya macro yang di password akan di backup ke workbook lain 
kemudian nantinya akan dirubah dngan pass baru,tapi kenapaya ketika saya run 
muncul the bug”variable not define”


Berikut potongan source nya


Private Sub CommandButton1_Click()





Dim hFile  As String


Dim inFile As Long, nLoop As Long


Dim Header As String


Dim State  As Boolean


'// Header Key VBA Password


Header = Chr(&HD) & Chr(&HA) & Chr(&H44) & Chr(&H50) & _


Chr(&H42) & Chr(&H3D) & Chr(&H22)


'// Buka File Excel & Word


hFile = GetFile(Hwnd)……………bla bla bla











From: [email protected] [mailto:[email protected]]
Sent: Wednesday, June 18, 2014 10:19 AM
To: [email protected]
Subject: Re: [belajar-excel] getfile








Hwnd pada kalimat tersebut adalah sebuah variabel. Typenya variant.
Detilnya tergantung isi prosedur.


Biasanya, variabel hwnd digunakan untuk menyimpan nomor handle windows yg 
bertipe long. Tapi pada kasus ini, ndak bisa dipastikan bahwa hwnd sebagai 
handle windows jika tidak melihat isi prosedur getfile.


On Jun 18, 2014 7:40 AM, "'irianto' [email protected] [belajar-excel]" 
<[email protected]> wrote:





Dear all master


Arti dari “Hwnd” dari source berikut:   hFile = GetFile(Hwnd),itu bahasa 
manusia nya apa ya?apakah alamat file yang akan kita ambil berada?


Trim’s atas pencerahannya






Kirim email ke