Hi all,

Saya sedang membuat macro otomatis membuka file excel yg terpassword.

Bagaimana trap nya jika user salah pilih file yg berpassword "ab" atau lainnya

Private sub cmb_click()
Dim newfile as string
Dim newfiletype as string
Dim newfilename as string
Dim wslama as workbook
Dim wsbaru as workbook

Newfiletype = "excel files 1997-2003 (*.xls), *.xls, " & "all files (*.*), *.*"
Newfile = 
application.getsaveasfilename(initialfilename:=newfilename,filefilter:=newfiletype)

If newfile<>"" and newfile <> "false" then
 Set wslama=workbooks.open(newfile,password:="abc")
Wsbaru.activate
End if
End sub


Attachment: trap if fail open.xls
Description: Binary data

Kirim email ke