I have a protected VBA project which I wrote code in XL 2000. Please HELP!!
I can not determine in the Module1 the compile error, all the code below is in Module1 and the Sub Showdialog is called on the Worksheet Selection change event in the workbook.
I have this statement and call ShowDialog
(Application.Run) on Worksheet Selection Change Event.
Why is this not working? I am at a loss. Thanks for your
help.
Thanks! George C.
Public Sub Decide2()
#If VBA6 Then
Call ShowModeless2
#Else
Job_Function.Show
#End If
End Sub
Public Sub ShowDialog()
Dim Msg As String
Dim Response As VbMsgBoxResult
Dim Style As MsoButtonStyle
Dim Title As String
Style = vbYesNo + vbCritical + vbDefaultButton2
Msg = "Do you want to add/change/delete job functions in
this cell?" & vbCrLf & vbCrLf & "If you do, you will need
to re-enter all the job functions again."
Title = "Job Title Selection Change"
If (((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$11"
Or (ActiveCell.Address
= "$E$11"
) And (ActiveCell.Value <> ""
) Or _
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$13"
Or (ActiveCell.Address
= "$E$13"
) And (ActiveCell.Value <> ""
) Or _
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$15"
Or (ActiveCell.Address
= "$E$15"
) And (ActiveCell.Value <> ""
) Or _
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$17"
Or (ActiveCell.Address
= "$E$17"
) And (ActiveCell.Value <> ""
) Or _
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$19"
Or (ActiveCell.Address
= "$E$19"
) And (ActiveCell.Value <> ""
) Or _
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$21"
Or (ActiveCell.Address
= "$E$21"
) And (ActiveCell.Value <> ""
) Or _
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$23"
Or (ActiveCell.Address
= "$E$23"
) And (ActiveCell.Value <> ""
) Or _
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$25"
Or (ActiveCell.Address
= "$E$25"
) And (ActiveCell.Value <> ""
) Or _
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$27"
Or (ActiveCell.Address
= "$E$27"
) And (ActiveCell.Value <> ""
) Or _
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$29"
Or (ActiveCell.Address
= "$E$29"
) And (ActiveCell.Value <> ""
) Then
Response = MsgBox(Msg, Style, Title)
If Response = vbNo Then
ActiveSheet.Unprotect Password:="2Tough"
Selection.Locked = True
ActiveSheet.Protect Password:="2Tough"
ActiveSheet.Unprotect Password:="2Tough"
Selection.Locked = False
ActiveSheet.Protect Password:="2Tough"
ActiveCell.Offset(, 1).Activate
Exit Sub
Else
Job_Function.ListBox1.RowSource = ""
' Add some items to the ListBox
With Job_Function.ListBox1
.RowSource = ""
.AddItem "1"
.AddItem "2"
.AddItem "3"
.AddItem "4"
.AddItem "5"
.AddItem "6"
.AddItem "7"
.AddItem "8"
.AddItem "9"
.AddItem "10"
.AddItem "11"
.AddItem "12"
.AddItem "13"
.AddItem "14"
.AddItem "15"
.AddItem "16"
.AddItem "17"
.AddItem "18"
.AddItem "19"
.AddItem "20"
.AddItem "21"
.AddItem "22"
.AddItem "23"
.AddItem "24"
.AddItem "25"
.AddItem "26"
.AddItem "27"
.AddItem "28"
.AddItem "29"
.AddItem "30"
.AddItem "31"
End With
Call Decide2
End If
Else
Job_Function.ListBox1.RowSource = ""
' Add some items to the ListBox
With Job_Function.ListBox1
.RowSource = ""
.AddItem "1"
.AddItem "2"
.AddItem "3"
.AddItem "4"
.AddItem "5"
.AddItem "6"
.AddItem "7"
.AddItem "8"
.AddItem "9"
.AddItem "10"
.AddItem "11"
.AddItem "12"
.AddItem "13"
.AddItem "14"
.AddItem "15"
.AddItem "16"
.AddItem "17"
.AddItem "18"
.AddItem "19"
.AddItem "20"
.AddItem "21"
.AddItem "22"
.AddItem "23"
.AddItem "24"
.AddItem "25"
.AddItem "26"
.AddItem "27"
.AddItem "28"
.AddItem "29"
.AddItem "30"
.AddItem "31"
End With
Call Decide2
Exit Sub
End If
End Sub
I can not determine in the Module1 the compile error, all the code below is in Module1 and the Sub Showdialog is called on the Worksheet Selection change event in the workbook.
I have this statement and call ShowDialog
(Application.Run) on Worksheet Selection Change Event.
Why is this not working? I am at a loss. Thanks for your
help.
Thanks! George C.
Public Sub Decide2()
#If VBA6 Then
Call ShowModeless2
#Else
Job_Function.Show
#End If
End Sub
Public Sub ShowDialog()
Dim Msg As String
Dim Response As VbMsgBoxResult
Dim Style As MsoButtonStyle
Dim Title As String
Style = vbYesNo + vbCritical + vbDefaultButton2
Msg = "Do you want to add/change/delete job functions in
this cell?" & vbCrLf & vbCrLf & "If you do, you will need
to re-enter all the job functions again."
Title = "Job Title Selection Change"
If (((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$11"
= "$E$11"
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$13"
= "$E$13"
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$15"
= "$E$15"
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$17"
= "$E$17"
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$19"
= "$E$19"
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$21"
= "$E$21"
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$23"
= "$E$23"
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$25"
= "$E$25"
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$27"
= "$E$27"
(((ActiveCell.Column = 4) Or (ActiveCell.Column = 5))
And ((ActiveCell.Address = "$D$29"
= "$E$29"
Response = MsgBox(Msg, Style, Title)
If Response = vbNo Then
ActiveSheet.Unprotect Password:="2Tough"
Selection.Locked = True
ActiveSheet.Protect Password:="2Tough"
ActiveSheet.Unprotect Password:="2Tough"
Selection.Locked = False
ActiveSheet.Protect Password:="2Tough"
ActiveCell.Offset(, 1).Activate
Exit Sub
Else
Job_Function.ListBox1.RowSource = ""
' Add some items to the ListBox
With Job_Function.ListBox1
.RowSource = ""
.AddItem "1"
.AddItem "2"
.AddItem "3"
.AddItem "4"
.AddItem "5"
.AddItem "6"
.AddItem "7"
.AddItem "8"
.AddItem "9"
.AddItem "10"
.AddItem "11"
.AddItem "12"
.AddItem "13"
.AddItem "14"
.AddItem "15"
.AddItem "16"
.AddItem "17"
.AddItem "18"
.AddItem "19"
.AddItem "20"
.AddItem "21"
.AddItem "22"
.AddItem "23"
.AddItem "24"
.AddItem "25"
.AddItem "26"
.AddItem "27"
.AddItem "28"
.AddItem "29"
.AddItem "30"
.AddItem "31"
End With
Call Decide2
End If
Else
Job_Function.ListBox1.RowSource = ""
' Add some items to the ListBox
With Job_Function.ListBox1
.RowSource = ""
.AddItem "1"
.AddItem "2"
.AddItem "3"
.AddItem "4"
.AddItem "5"
.AddItem "6"
.AddItem "7"
.AddItem "8"
.AddItem "9"
.AddItem "10"
.AddItem "11"
.AddItem "12"
.AddItem "13"
.AddItem "14"
.AddItem "15"
.AddItem "16"
.AddItem "17"
.AddItem "18"
.AddItem "19"
.AddItem "20"
.AddItem "21"
.AddItem "22"
.AddItem "23"
.AddItem "24"
.AddItem "25"
.AddItem "26"
.AddItem "27"
.AddItem "28"
.AddItem "29"
.AddItem "30"
.AddItem "31"
End With
Call Decide2
Exit Sub
End If
End Sub