引数に指定したファイルの存在
If Dir(MyPath) = "" Then
MsgBox "「AAA.xlsm」を置いてください。", vbExclamation
Exit Sub
End If
任意で編集・保存
Option Compare Database
Option Explicit
Dim flg As Boolean
Private Sub Form_BeforeUpdate(Cancel As Integer)
If flg Then
Cancel = True
End If
End Sub
Private Sub cmd編集_Click()
flg = True
If flg Then
Me.Form.AllowEdits = True
End If
' "AllowEdits/更新の許可" - [Yes/はい]
' "AllowDeletions/削除の許可" - [Yes/はい]
' "AllowAdditions/追加の許可" - [Yes/はい]
' "DataEntry/データ入力用" - [No/いいえ]
End Sub
Private Sub cmd保存_Click()
Dim frm As Form
Dim ctl As Control
Dim intCntrlType As Integer
Set frm = Forms!f_AAA
If flg Then
flg = False
intCntrlType = acTextBox
For Each ctl In frm.Controls
With ctl
If .ControlType = intCntrlType Then
.Locked = True
End If
End With
Next
End If
Set frm = Nothing
End Sub
'ラベル acLabel
'コマンド ボタン acCommandButton
'オプション ボタン acOptionButton
'チェック ボックス acCheckBox
'テキスト ボックス acTextBox
'リスト ボックス acListBox
'コンボ ボックス acComboBox
最終更新:2011年06月17日 10:56