F
Fabio Carvalho
I have setup a Word document with 9 checkboxes on it, each of which will be
executing very similar code. The only change in the code is actually the
number I have assigned to the corresponding objects that the given checkbox
affects. I was hoping to use an array to avoid having to put excess similar
code behind all 9 checkboxes. Any suggestions you can give me on how I can
use an array for these checkboxes will be greatly appreciated. I have
included the routine below. Thank you in advance for your assistance.
*************************************************************
Private Sub chkAppr1_Click()
On Error GoTo Err_chkAppr1_Click
If chkAppr1.Value = True Then
If chkReject1.Value = True Then
chkReject1.Value = False
End If
imgAppr1.Picture = LoadPicture("H:\Signature.bmp")
lblAppr1.Caption = Format(DateTime.Date, "m/d/yy")
imgAppr1.BackColor = &H8000000F
Else
imgAppr1.Picture = LoadPicture("")
lblAppr1.Caption = ""
imgAppr1.BackColor = &H8000000F
End If
Exit_chkAppr1_Click:
Exit Sub
Err_chkAppr1_Click:
If Err.Number = 76 Then
MsgBox "Your signature file could not be found. Please make sure
that your H:\ drive" _
& " is available and that a signature file is present within it. If
your H:\ drive is not" _
& " available, please reboot & relogin to your PC. If you do not
have a signature" _
& " file, please see your system administrator.", vbCritical +
vbOKOnly, "Signature Not Found"
Else
MsgBox Err.Description
End If
Resume Exit_chkAppr1_Click
End Sub
*********************************************************************
executing very similar code. The only change in the code is actually the
number I have assigned to the corresponding objects that the given checkbox
affects. I was hoping to use an array to avoid having to put excess similar
code behind all 9 checkboxes. Any suggestions you can give me on how I can
use an array for these checkboxes will be greatly appreciated. I have
included the routine below. Thank you in advance for your assistance.
*************************************************************
Private Sub chkAppr1_Click()
On Error GoTo Err_chkAppr1_Click
If chkAppr1.Value = True Then
If chkReject1.Value = True Then
chkReject1.Value = False
End If
imgAppr1.Picture = LoadPicture("H:\Signature.bmp")
lblAppr1.Caption = Format(DateTime.Date, "m/d/yy")
imgAppr1.BackColor = &H8000000F
Else
imgAppr1.Picture = LoadPicture("")
lblAppr1.Caption = ""
imgAppr1.BackColor = &H8000000F
End If
Exit_chkAppr1_Click:
Exit Sub
Err_chkAppr1_Click:
If Err.Number = 76 Then
MsgBox "Your signature file could not be found. Please make sure
that your H:\ drive" _
& " is available and that a signature file is present within it. If
your H:\ drive is not" _
& " available, please reboot & relogin to your PC. If you do not
have a signature" _
& " file, please see your system administrator.", vbCritical +
vbOKOnly, "Signature Not Found"
Else
MsgBox Err.Description
End If
Resume Exit_chkAppr1_Click
End Sub
*********************************************************************