Hi all,

Maaf kalau saya forward, krn spt nya belum ada yg merespon. Thanks in advance
-----Original Message-----
From: the_x_mi...@yahoo.com
Sender: belajar-excel@yahoogroups.com
Date: Wed, 28 Nov 2012 08:05:02 
To: <belajar-excel@yahoogroups.com>
Reply-To: belajar-excel@yahoogroups.com
Subject: [belajar-excel] trap if fail to open password protected excel

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



Kirim email ke