Ohh yang saya tampilkan hanya pada bagian yang eror Mr.Kid
Kumplitannya begini dari mas Zain
'=================================
Function PasswordKu()
Dim pwd As String, i As Integer
Dim arrSymbol As Variant
arrSymbol = Array("!", "@", "#", "$", "%", "^", "&")
With Application.WorksheetFunction
i = .Weekday(Now, 2)
pwd = .Text(Now, "[$-421]ddd" & arrSymbol(i - 1) & "dd-mm-yyyy")
End With
PasswordKu = pwd
End Function
Sub ProtectSheets(ByVal bolProtect As Boolean)
Dim sht As Worksheet
For Each sht In ActiveWorkbook.Worksheets
If bolProtect Then
sht.Protect PasswordKu
Else
sht.Unprotect PasswordKu di sini terjadi galat, mungkinkah maksudya adalah
sht.Protect PasswordKu
End If
Next
End Sub
'=====code ini di tulis di object workbook==============
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ProtectSheets False
End Sub
Private Sub Workbook_Open()
ProtectSheets True
End Sub
'===========================
From: [email protected] [mailto:[email protected]]
On Behalf Of Mr. Kid
Sent: 26 September 2013 16:29
To: BeExcel
Subject: Re: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka
Bukankah function yang dibuat mas Zain bernama PasswordKu_
Coba gunakan PasswordKu_ daripada PasswordKu
Wassalam,
Kid.
2013/9/26 PRAZT <[email protected] <mailto:[email protected]> >
@_Iya M.Kid, jadi user harus enable security macronya, tapi saya akali
dengan memaksa user harus mengenabelkan security macro (tapi masih
menggunakan VBA sih) ato mungkin Mr.Kid ada solusi untuk hal ini ?
@_Mas Zainul, bisa tuh coba untuk hari ini dan besok hasilnya gmn...tapi
mungkin tidak itu terjadi seperti yang dikatakan Mr.Kid...
Terus pas saat di buka file tersebut terjadi eror pada bagian per tanda
kuning berikut :
Sub ProtectSheets(ByVal bolProtect As Boolean)
Dim sht As Worksheet
For Each sht In ActiveWorkbook.Worksheets
If bolProtect Then
sht.Protect PasswordKu
Else
sht.Unprotect PasswordKu apakah mungkin maksudnya adalah sht.Protect
PasswordKu
End If
Next
End Sub
From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]>
] On Behalf Of Mr. Kid
Sent: 26 September 2013 15:45
To: BeExcel
Subject: Re: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka
Dengan cara yang dipakai mas Prazt ini, jika file dibuka pada komputer yang
Macro Security didisable atau belum dienablekan oleh user, maka semua sheet
dalam keadaan unprotected alias bisa diubah isinya.
Wassalam,
Kid.
2013/9/26 zainul_ulum[at]yahoo[dot]com <[email protected]
<mailto:[email protected]> >
Passwordnya sepertinya sih nggak berubah kalo ganti hari.
tetapi bisa dicoba dengan urutan sbb:
1. Sebelum Workbook ditutup unprotect semua sheet
2. Jika suatu saat workbook dibuka, protect semua worksheet dengan password
baru
'=================================
Function PasswordKu()
Dim pwd As String, i As Integer
Dim arrSymbol As Variant
arrSymbol = Array("!", "@", "#", "$", "%", "^", "&")
With Application.WorksheetFunction
i = .Weekday(Now, 2)
pwd = .Text(Now, "[$-421]ddd" & arrSymbol(i - 1) & "dd-mm-yyyy")
End With
PasswordKu = pwd
End Function
Sub ProtectSheets(ByVal bolProtect As Boolean)
Dim sht As Worksheet
For Each sht In ActiveWorkbook.Worksheets
If bolProtect Then
sht.Protect PasswordKu
Else
sht.Unprotect PasswordKu
End If
Next
End Sub
'=======================
'=====code ini di tulis di object workbook==============
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ProtectSheets False
End Sub
Private Sub Workbook_Open()
ProtectSheets True
End Sub
'===========================
From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]>
] On Behalf Of PRAZT
Sent: Thursday, September 26, 2013 2:30 PM
To: [email protected] <mailto:[email protected]>
Subject: RE: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka
Berarti harus di unprotect semua dulu mas Zainul?, tapi nanti kalau berganti
hari kira-kira passwordnya ikutan berganti undak ya?....ok Mr. Zainul, Suwun
dah membantu+koreksi, Syukron Katsiron....
PRAZTMATH T
From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]>
] On Behalf Of zainul_ulum[at]yahoo[dot]com
Sent: 26 September 2013 14:21
To: [email protected] <mailto:[email protected]>
Subject: RE: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka
coba di unprotect dulu semua sheet, kemudian dijalankan lagi macronya.
From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]>
] On Behalf Of PRAZT
Sent: Thursday, September 26, 2013 2:12 PM
To: [email protected] <mailto:[email protected]>
Subject: RE: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka
O ya maap kelebihan y di dd-mm-yyyy, tapi coba buka sheet 3 di file yang
terakhir tadi, passwordnya tidak bisa dibuka dengan Kamis$26-09-2013, tapi
bisanya Kamis$26-09-13 padahal di vba kodenya merujuk ke Kamis$26-09-2013
pwd = .Text(Now, "[$-421]ddd" & arrSymbol(i - 1) & "dd-mm-yyyy")
Kalau sheet 1 dan sheet2 OK paswordnya Kamis$26-09-2013 karena saya buka
password sebelum saya merubah kode di VBA pwd = .Text(Now, "[$-421]ddd" &
arrSymbol(i - 1) & "dd-mm-yy") menjadi pwd = .Text(Now, "[$-421]ddd" &
arrSymbol(i - 1) & "dd-mm-yyyy"). mohon koreksinya Mas Zainul+Mr.HK+Mr.Kid
atau master yang lain...
PRAZTMATH T
From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]>
] On Behalf Of zainul_ulum[at]yahoo[dot]com
Sent: 26 September 2013 13:34
To: [email protected] <mailto:[email protected]>
Subject: RE: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka
jawabannya sama dengan Pak HK.
terimakasih koreksinya.
From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]>
] On Behalf Of hendrik karnadi
Sent: Thursday, September 26, 2013 12:33 PM
To: [email protected] <mailto:[email protected]>
Subject: Re: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka
Ikutan njawab.
Barangkali karena kelbihan sau "y".
pwd = .Text(Now, "[$-421]ddd" & arrSymbol(i - 1) & "dd-mm-yyyyy")
Salam,
HK
________________________________________
From: PRAZT <[email protected] <mailto:[email protected]> >
To: [email protected] <mailto:[email protected]>
Sent: Thursday, 26 September 2013, 12:23
Subject: RE: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka [1 Attachment]
Jika saya saya modifikasi seperti file terlampir terus file saya tutup dan
dibuka lagi kok passwordnya masih
"Kamis$26-09-13"(tanpa tanda petik) yang seharusnya "Kamis$26-09-2013", jadi
pada intinya password tidak bisa berubah sebelum paswordnya di Unprotect
dulu...mohon penjelasa mas Zainul.
From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]>
] On Behalf Of zainul_ulum[at]yahoo[dot]com
Sent: 26 September 2013 10:47
To: [email protected] <mailto:[email protected]>
Subject: RE: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka [1 Attachment]
terlampir file yang sudah saya coba...
-----Original Message-----
From: zainul_ulum[at]yahoo[dot]com [mailto:[email protected]
<mailto:[email protected]> ]
Sent: Thursday, September 26, 2013 10:35 AM
To: '[email protected] <mailto:[email protected]> '
Subject: RE: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka
maaf sekali kalo nggak bisa,
seharusnya sih bisa karena fungsi tersebut saya coba di excel saya, tidak
masalah
coba diganti
pwd = .Text(Now, "[$-421]ddd" & arrSymbol(i - 1) & " dd-mm-yy") 'ada spasi
di depan dd
menjadi
pwd = .Text(Now, "[$-421]ddd" & arrSymbol(i - 1) & "dd-mm-yy") 'spasi
dihilangkan
wassalam
-zainul-
From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]>
]
On Behalf Of PRAZT
Sent: Thursday, September 26, 2013 9:47 AM
To: [email protected] <mailto:[email protected]>
Subject: RE: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka
Malah tidak jalan mas zainul
From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]>
]
On Behalf Of zainul_ulum[at]yahoo[dot]com
Sent: 26 September 2013 08:44
To: [email protected] <mailto:[email protected]>
Subject: RE: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka
mungkin yang dimaksud seperti ini ya.
'===================
Function PasswordKu()
Dim pwd As String, i As Integer
Dim arrSymbol As Variant
arrSymbol = Array("!", "@", "#", "$", "%", "^", "&")
With Application.WorksheetFunction
i = .Weekday(Now, 2)
pwd = .Text(Now, "[$-421]ddd" & arrSymbol(i - 1) & " dd-mm-yy") End With
PasswordKu = pwd End Function '============================================
From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]>
]
On Behalf Of zainul_ulum[at]yahoo[dot]com
Sent: Thursday, September 26, 2013 8:35 AM
To: [email protected] <mailto:[email protected]>
Subject: RE: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka
coba code berikut:
Function PasswordKu_()
Dim pwd As String
With Application.WorksheetFunction
'aturan memberi symbol $ # @ masih belum jelas aturannya 'secara default
diberi symbol |
pwd = .Text(Now, "[$-421]ddd|dd-mm-yy")
'mengganti symbol | dengan misal $
pwd = .Substitute(pwd, "|", "$")
End With
PasswordKu_=pwd
End Function
From: [email protected] <mailto:[email protected]>
[mailto:[email protected] <mailto:[email protected]>
]
On Behalf Of PRAZT
Sent: Thursday, September 26, 2013 8:03 AM
To: group excel
Subject: [belajar-excel] paswword sheet berganti sesuai nama hari dan
tanggal dibuka [1 Attachment]
Assalammu'alaikum...
dear master dan suhu, saya kesulitan lagi tentang VBA untuk excel dengan
alur cerita begini; saya ingin memprotect sheet-sheet pada file excel bisa
berganti setiap file dibuka dengan kombinasi Hari, karakter(simpul), dan
tanggal Diana file dibuka. bagaimana kode VBA_nya jika pasword tersebut
adalah kombinasi nama hari,karakter(simbol), dan tanggal pada waktu file di
buka dimana simbol diambil dari nomor hari jika hari dimulai dengan hari
Minggu contoh file dibuka pada hari senin tanggal 23 september 2013 maka
passwordnya adalah ;
Senin@23-09-2013 kalau dibuka hari selasa maka passwordnya
Selasa#24-09-2013 kalau dibuka hari Rabu maka passwordnya
Rabu$25-09-2013 saya sudah berusaha untuk menambahkan kode-kode VBA tapi
mentok pada kesulitan. Wassalam...
PRAZTMATH T