PDA

View Full Version : Application pop up messages



Aaronjames
10-31-2017, 09:35 PM
I have a Template document that once opened you get the following message

20825
Once you Click ok, you then need to click the "Enable Macros" banner (which is fine) however then you get the following message:
20826

Once you press ok, it's all fine and takes you to the user form, however is there a way i can stop these from coming up?

Thanks in advance

gmayor
10-31-2017, 10:15 PM
In the case of the first message, provided you are sure about the pedigree of the template, put it in a trusted folder.
With regard to the second message, this suggests a problem with the code. Without access to the template and its code it will not be possible to debug it.

Aaronjames
11-01-2017, 02:29 AM
Hi Graham,
Thanks for your response

I was intending to put this on a shared drive. Is there a way I can make sure this message does not pop up?

also, is there a way I can see what the bug is?

Aaronjames
11-01-2017, 03:31 AM
This is the code i'm using:



Private Sub CheckBox1_Change()
If CheckBox1.Value = False Then
TextBox18.Visible = False
Label23.Visible = False
Frame12.Visible = False
Frame13.Visible = False
Frame14.Visible = False
Frame15.Visible = False
Frame11.Visible = False
End If
End Sub




Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
TextBox18.Visible = True
Label23.Visible = True
Frame12.Visible = True
Frame13.Visible = True
Frame14.Visible = True
Frame15.Visible = True
Frame11.Visible = True
End If
End Sub




Private Sub CheckBox2_Change()
If CheckBox2.Value = False Then
TextBox20.Visible = False
Label26.Visible = False
Frame17.Visible = False
Frame19.Visible = False
Frame20.Visible = False
Frame18.Visible = False
Frame16.Visible = False
End If
End Sub




Private Sub CheckBox2_Click()
If CheckBox2.Value = True Then
TextBox20.Visible = True
Label26.Visible = True
Frame17.Visible = True
Frame19.Visible = True
Frame20.Visible = True
Frame18.Visible = True
Frame16.Visible = True
End If
End Sub


Private Sub ComboBox1_DropButtonClick()
ComboBox1.List = Array("VIC", "WA", "SA", "NSW", "QLD", "NT", "TAS", "ACT")
End Sub



Private Sub ComboBox2_DropButtonClick()
ComboBox2.List = Array("VIC", "WA", "SA", "NSW", "QLD", "NT", "TAS", "ACT")
End Sub


Private Sub ComboBox3_DropButtonClick()
ComboBox3.List = Array("VIC", "WA", "SA", "NSW", "QLD", "NT", "TAS", "ACT")
End Sub



Private Sub ComboBox4_DropButtonClick()
ComboBox4.List = Array("VIC", "WA", "SA", "NSW", "QLD", "NT", "TAS", "ACT")
End Sub





Private Sub CommandButton2_Click()
ActiveDocument.Unprotect Password:="mosaic"
If TextBox1.Text = "" Then
Cancel = 1
MsgBox "Please Enter: Your Name in 'Your Information'"
Exit Sub
End If
If TextBox6.Text = "" Then
Cancel = 1
MsgBox "Please Enter: Your Branch in 'Your Information'"
Exit Sub
End If
If ComboBox2.ListIndex = -1 Then
Cancel = 1
MsgBox "Please Select: Your State in 'Your Information'"
Exit Sub
End If
If TextBox10.Text = "" Then
Cancel = 1
MsgBox "Please Enter: Your Office Account BSB in 'Your Information'"
Exit Sub
End If
If TextBox11.Text = "" Then
Cancel = 1
MsgBox "Please Enter: Your Office Account Number in 'Your Information'"
Exit Sub
End If
If TextBox12.Text = "" Then
Cancel = 1
MsgBox "Please Enter: The Customer Number in 'Customer Information'"
Exit Sub
End If
If TextBox13.Text = "" Then
Cancel = 1
MsgBox "Please Enter: The Customer Name in 'Customer Information'"
Exit Sub
End If
If TextBox16.Text = "" Then
Cancel = 1
MsgBox "Please Enter: The property identifier (ie. Address or Tenant)"
Exit Sub
End If
If OptionButton10.Value = False And OptionButton11.Value = False And OptionButton12.Value = False And OptionButton13.Value = False And OptionButton18.Value = False And OptionButton14.Value = False And OptionButton17.Value = False And OptionButton15.Value = False And OptionButton16.Value = False Then
Cancel = 1
MsgBox "Please Select: What you require to be reviewed"
Exit Sub
End If
If ComboBox1.ListIndex = -1 Then
Cancel = 1
MsgBox "Please Select: The state of the leases property"
Exit Sub
End If
If OptionButton7.Value = False And OptionButton8.Value = False And OptionButton9.Value = False Then
Cancel = 1
MsgBox "Please Select: The reason for the review"
Exit Sub
End If
If OptionButton2.Value = False And OptionButton1.Value = False Then
Cancel = 1
MsgBox "Please Answer: Does this lease relate to an SMSF Transaction?"
Exit Sub
End If
If OptionButton3.Value = False And OptionButton4.Value = False Then
Cancel = 1
MsgBox "Please Answer: Is a liquor Licence involved?"
Exit Sub
End If

If CheckBox1.Value = True And TextBox18.Text = "" Then
Cancel = 1
MsgBox "You have requested the review of a 2nd Lease:Please enter the property identifier (ie. Address or Tenant)"
Exit Sub
End If
If CheckBox1.Value = True And (OptionButton21.Value = False And OptionButton22.Value = False And OptionButton23.Value = False And OptionButton24.Value = False And OptionButton29.Value = False And OptionButton25.Value = False And OptionButton28.Value = False And OptionButton26.Value = False And OptionButton27.Value = False) Then
Cancel = 1
MsgBox "You have requested the review of a 2nd Lease: Please select what you require to be reviewed"
Exit Sub
End If
If CheckBox1.Value = True And ComboBox3.ListIndex = -1 Then
Cancel = 1
MsgBox "You have requested the review of a 2nd Lease: Please select the state of the leases property"
Exit Sub
End If
If CheckBox1.Value = True And (OptionButton32.Value = False And OptionButton33.Value = False And OptionButton34.Value = False) Then
Cancel = 1
MsgBox "You have requested the review of a 2nd Lease: Please select the reason for the review"
Exit Sub
End If
If CheckBox1.Value = True And (OptionButton30.Value = False And OptionButton31.Value = False) Then
Cancel = 1
MsgBox "You have requested the review of a 2nd Lease: Please answer 'Does this lease relate to an SMSF Transaction?'"
Exit Sub
End If
If CheckBox1.Value = True And (OptionButton19.Value = False And OptionButton20.Value = False) Then
Cancel = 1
MsgBox "You have requested the review of a 2nd Lease: Please answer 'Is a liquor Licence involved?'"
Exit Sub
End If

If CheckBox2.Value = True And TextBox20.Text = "" Then
Cancel = 1
MsgBox "You have requested the review of a 3rd Lease:Please enter the property identifier (ie. Address or Tenant)"
Exit Sub
End If
If CheckBox2.Value = True And (OptionButton37.Value = False And OptionButton38.Value = False And OptionButton39.Value = False And OptionButton40.Value = False And OptionButton45.Value = False And OptionButton41.Value = False And OptionButton44.Value = False And OptionButton42.Value = False And OptionButton43.Value = False) Then
Cancel = 1
MsgBox "You have requested the review of a 3rd Lease: Please select what you require to be reviewed"
Exit Sub
End If
If CheckBox2.Value = True And ComboBox4.ListIndex = -1 Then
Cancel = 1
MsgBox "You have requested the review of a 3rd Lease: Please select the state of the leases property"
Exit Sub
End If
If CheckBox2.Value = True And (OptionButton48.Value = False And OptionButton49.Value = False And OptionButton50.Value = False) Then
Cancel = 1
MsgBox "You have requested the review of a 3rd Lease: Please select the reason for the review"
Exit Sub
End If
If CheckBox2.Value = True And (OptionButton46.Value = False And OptionButton47.Value = False) Then
Cancel = 1
MsgBox "You have requested the review of a 3rd Lease: Please answer 'Does this lease relate to an SMSF Transaction?'"
Exit Sub
End If
If CheckBox2.Value = True And (OptionButton35.Value = False And OptionButton36.Value = False) Then
Cancel = 1
MsgBox "You have requested the review of a 3rd Lease: Please answer 'Is a liquor Licence involved?'"
Exit Sub
End If



Dim DateP As Range
Set DateP = ActiveDocument.Bookmarks("Date").Range
DateP.Text = Me.DTPicker1.Value

Dim Banker As Range
Set Banker = ActiveDocument.Bookmarks("Name").Range
Banker.Text = Me.TextBox1.Value
Dim Branch As Range
Set Branch = ActiveDocument.Bookmarks("Branch").Range
Branch.Text = Me.TextBox6.Value
Dim BSB As Range
Set BSB = ActiveDocument.Bookmarks("AccBSB").Range
BSB.Text = Me.TextBox10.Value
Dim Account As Range
Set Account = ActiveDocument.Bookmarks("AccNum").Range
Account.Text = Me.TextBox11.Value
Dim Number As Range
Dim State As Range
Set State = ActiveDocument.Bookmarks("State").Range
State.Text = Me.ComboBox2.Value
Set Number = ActiveDocument.Bookmarks("CustNum").Range
Number.Text = Me.TextBox12.Value
Dim Trustee As Range
Set Trustee = ActiveDocument.Bookmarks("CustName").Range
Trustee.Text = Me.TextBox13.Value

Dim PropID1 As Range
Set PropID1 = ActiveDocument.Bookmarks("Prop1ID").Range
PropID1.Text = Me.TextBox16.Value

If OptionButton10.Value = True Then
Dim Re11 As Range
Set Re11 = ActiveDocument.Bookmarks("Prop1Re").Range
Re11.Text = "Lease"
ActiveDocument.Bookmarks("D5").Range.Delete
ActiveDocument.Bookmarks("D7").Range.Delete
ActiveDocument.Bookmarks("D6").Range.Delete
ActiveDocument.Bookmarks("D8").Range.Delete
ActiveDocument.Bookmarks("D9").Range.Delete
ActiveDocument.Bookmarks("D10").Range.Delete
ActiveDocument.Bookmarks("D12").Range.Delete
End If
If OptionButton10.Value = True And ComboBox1.Value <> "QLD" Then
ActiveDocument.Bookmarks("D2").Range.Delete
ActiveDocument.Bookmarks("D11").Range.Delete
End If
If OptionButton10.Value = True And ComboBox1.Value <> "NT" Then
ActiveDocument.Bookmarks("D3").Range.Delete
End If
If OptionButton10.Value = True And ComboBox1.Value <> "NSW" Then
ActiveDocument.Bookmarks("D4").Range.Delete
End If
If OptionButton10.Value = True And ComboBox1.Value = "QLD" Then
ActiveDocument.Bookmarks("D1").Range.Delete
End If
If OptionButton10.Value = True And ComboBox1.Value = "NT" Then
ActiveDocument.Bookmarks("D1").Range.Delete
End If
If OptionButton11.Value = True Then
Dim Re12 As Range
Set Re12 = ActiveDocument.Bookmarks("Prop1Re").Range
Re12.Text = "Lease and Variation/s"
ActiveDocument.Bookmarks("D5").Range.Delete
ActiveDocument.Bookmarks("D8").Range.Delete
ActiveDocument.Bookmarks("D9").Range.Delete
ActiveDocument.Bookmarks("D10").Range.Delete
ActiveDocument.Bookmarks("D12").Range.Delete
End If
If OptionButton11.Value = True And ComboBox1.Value <> "QLD" Then
ActiveDocument.Bookmarks("D2").Range.Delete
ActiveDocument.Bookmarks("D7").Range.Delete
ActiveDocument.Bookmarks("D11").Range.Delete
End If
If OptionButton11.Value = True And ComboBox1.Value <> "NT" Then
ActiveDocument.Bookmarks("D3").Range.Delete
End If
If OptionButton11.Value = True And ComboBox1.Value <> "NSW" Then
ActiveDocument.Bookmarks("D4").Range.Delete
End If
If OptionButton11.Value = True And ComboBox1.Value = "QLD" Then
ActiveDocument.Bookmarks("D1").Range.Delete
ActiveDocument.Bookmarks("D6").Range.Delete
End If
If OptionButton11.Value = True And ComboBox1.Value = "NT" Then
ActiveDocument.Bookmarks("D1").Range.Delete
End If
If OptionButton12.Value = True Then
Dim Re13 As Range
Set Re13 = ActiveDocument.Bookmarks("Prop1Re").Range
Re13.Text = "Variation of Lease or Sublease"
ActiveDocument.Bookmarks("D1").Range.Delete
ActiveDocument.Bookmarks("D2").Range.Delete
ActiveDocument.Bookmarks("D3").Range.Delete
ActiveDocument.Bookmarks("D4").Range.Delete
ActiveDocument.Bookmarks("D5").Range.Delete
ActiveDocument.Bookmarks("D8").Range.Delete
ActiveDocument.Bookmarks("D9").Range.Delete
ActiveDocument.Bookmarks("D10").Range.Delete
End If
If OptionButton12.Value = True And ComboBox1.Value <> "QLD" Then
ActiveDocument.Bookmarks("D7").Range.Delete
ActiveDocument.Bookmarks("D11").Range.Delete
End If
If OptionButton12.Value = True And ComboBox1.Value = "QLD" Then
ActiveDocument.Bookmarks("D6").Range.Delete
End If

If OptionButton13.Value = True Then
Dim Re14 As Range
Set Re14 = ActiveDocument.Bookmarks("Prop1Re").Range
Re14.Text = "Agreement for Lease"
ActiveDocument.Bookmarks("D1").Range.Delete
ActiveDocument.Bookmarks("D2").Range.Delete
ActiveDocument.Bookmarks("D3").Range.Delete
ActiveDocument.Bookmarks("D4").Range.Delete
ActiveDocument.Bookmarks("D6").Range.Delete
ActiveDocument.Bookmarks("D7").Range.Delete
ActiveDocument.Bookmarks("D5").Range.Delete
ActiveDocument.Bookmarks("D9").Range.Delete
ActiveDocument.Bookmarks("D10").Range.Delete
ActiveDocument.Bookmarks("D12").Range.Delete
ActiveDocument.Bookmarks("D11").Range.Delete
End If
If OptionButton18.Value = True Then
Dim Re15 As Range
Set Re15 = ActiveDocument.Bookmarks("Prop1Re").Range
Re15.Text = "Lease and Agreement for Lease"
ActiveDocument.Bookmarks("D5").Range.Delete
ActiveDocument.Bookmarks("D7").Range.Delete
ActiveDocument.Bookmarks("D6").Range.Delete
ActiveDocument.Bookmarks("D9").Range.Delete
ActiveDocument.Bookmarks("D10").Range.Delete
ActiveDocument.Bookmarks("D12").Range.Delete
End If
If OptionButton18.Value = True And ComboBox1.Value <> "QLD" Then
ActiveDocument.Bookmarks("D2").Range.Delete
ActiveDocument.Bookmarks("D11").Range.Delete
End If
If OptionButton18.Value = True And ComboBox1.Value <> "NT" Then
ActiveDocument.Bookmarks("D3").Range.Delete
End If
If OptionButton18.Value = True And ComboBox1.Value <> "NSW" Then
ActiveDocument.Bookmarks("D4").Range.Delete
End If
If OptionButton18.Value = True And ComboBox1.Value = "QLD" Then
ActiveDocument.Bookmarks("D1").Range.Delete
End If
If OptionButton18.Value = True And ComboBox1.Value = "NT" Then
ActiveDocument.Bookmarks("D1").Range.Delete
End If

If OptionButton14.Value = True Then
Dim Re16 As Range
Set Re16 = ActiveDocument.Bookmarks("Prop1Re").Range
Re16.Text = "Sublease"
ActiveDocument.Bookmarks("D1").Range.Delete
ActiveDocument.Bookmarks("D2").Range.Delete
ActiveDocument.Bookmarks("D3").Range.Delete
ActiveDocument.Bookmarks("D4").Range.Delete
ActiveDocument.Bookmarks("D6").Range.Delete
ActiveDocument.Bookmarks("D7").Range.Delete
ActiveDocument.Bookmarks("D8").Range.Delete
ActiveDocument.Bookmarks("D9").Range.Delete
ActiveDocument.Bookmarks("D10").Range.Delete
End If
If OptionButton14.Value = True And ComboBox1.Value <> "QLD" Then
ActiveDocument.Bookmarks("D11").Range.Delete
End If
If OptionButton17.Value = True Then
Dim Re17 As Range
Set Re17 = ActiveDocument.Bookmarks("Prop1Re").Range
Re17.Text = "Lease and Sublease"
ActiveDocument.Bookmarks("D7").Range.Delete
ActiveDocument.Bookmarks("D6").Range.Delete
ActiveDocument.Bookmarks("D8").Range.Delete
ActiveDocument.Bookmarks("D9").Range.Delete
ActiveDocument.Bookmarks("D10").Range.Delete
ActiveDocument.Bookmarks("D12").Range.Delete
End If
If OptionButton17.Value = True And ComboBox1.Value <> "QLD" Then
ActiveDocument.Bookmarks("D2").Range.Delete
ActiveDocument.Bookmarks("D11").Range.Delete
End If
If OptionButton17.Value = True And ComboBox1.Value <> "NT" Then
ActiveDocument.Bookmarks("D3").Range.Delete
End If
If OptionButton17.Value = True And ComboBox1.Value <> "NSW" Then
ActiveDocument.Bookmarks("D4").Range.Delete
End If
If OptionButton17.Value = True And ComboBox1.Value = "QLD" Then
ActiveDocument.Bookmarks("D1").Range.Delete
End If
If OptionButton17.Value = True And ComboBox1.Value = "NT" Then
ActiveDocument.Bookmarks("D1").Range.Delete
End If

If OptionButton15.Value = True Then
Dim Re18 As Range
Set Re18 = ActiveDocument.Bookmarks("Prop1Re").Range
Re18.Text = "Transfer or Assignment of Lease or Sublease"
ActiveDocument.Bookmarks("D1").Range.Delete
ActiveDocument.Bookmarks("D2").Range.Delete
ActiveDocument.Bookmarks("D3").Range.Delete
ActiveDocument.Bookmarks("D4").Range.Delete
ActiveDocument.Bookmarks("D5").Range.Delete
ActiveDocument.Bookmarks("D6").Range.Delete
ActiveDocument.Bookmarks("D7").Range.Delete
ActiveDocument.Bookmarks("D8").Range.Delete
ActiveDocument.Bookmarks("D10").Range.Delete
End If
If OptionButton15.Value = True And ComboBox1.Value <> "QLD" Then
ActiveDocument.Bookmarks("D11").Range.Delete
End If

If OptionButton16.Value = True Then
Dim Re19 As Range
Set Re19 = ActiveDocument.Bookmarks("Prop1Re").Range
Re19.Text = "Surrender or Request for Determination of Lease or Sublease"
ActiveDocument.Bookmarks("D1").Range.Delete
ActiveDocument.Bookmarks("D2").Range.Delete
ActiveDocument.Bookmarks("D3").Range.Delete
ActiveDocument.Bookmarks("D4").Range.Delete
ActiveDocument.Bookmarks("D5").Range.Delete
ActiveDocument.Bookmarks("D6").Range.Delete
ActiveDocument.Bookmarks("D7").Range.Delete
ActiveDocument.Bookmarks("D8").Range.Delete
ActiveDocument.Bookmarks("D9").Range.Delete
ActiveDocument.Bookmarks("D12").Range.Delete
End If
If OptionButton16.Value = True And ComboBox1.Value <> "QLD" Then
ActiveDocument.Bookmarks("D11").Range.Delete
End If

If OptionButton7.Value = True Then
Dim Reason1 As Range
Set Reason1 = ActiveDocument.Bookmarks("Reason1").Range
Reason1.Text = "NAB as existing Mortgagee (Consent Requested)"
End If
If OptionButton8.Value = True Then
Dim Reason11 As Range
Set Reason11 = ActiveDocument.Bookmarks("Reason1").Range
Reason11.Text = "NAB as proposed Mortgagee"
End If
If OptionButton9.Value = True Then
Dim Reason111 As Range
Set Reason111 = ActiveDocument.Bookmarks("Reason1").Range
Reason111.Text = "Rights of the Lessee - Not taking a mortgage of Lease"
End If

If OptionButton1.Value = True Then
Dim SMSFY As Range
Set SMSFY = ActiveDocument.Bookmarks("SMSF1").Range
SMSFY.Text = "Yes"
End If
If OptionButton2.Value = True Then
Dim SMSFN As Range
Set SMSFN = ActiveDocument.Bookmarks("SMSF1").Range
SMSFN.Text = "No"
End If
If OptionButton2.Value = True Then
ActiveDocument.Bookmarks("D13").Range.Delete
End If

If OptionButton3.Value = True Then
Dim LL As Range
Set LLY = ActiveDocument.Bookmarks("LL1").Range
LLY.Text = "Yes"
End If
If OptionButton4.Value = True Then
Dim LLN As Range
Set LLN = ActiveDocument.Bookmarks("LL1").Range
LLN.Text = "No"
End If

If CheckBox1.Value <> True Then
ActiveDocument.Bookmarks("Lease2").Range.Delete
ActiveDocument.Bookmarks("LLL2").Range.Delete
ActiveDocument.Bookmarks("SSMSF2").Range.Delete
ActiveDocument.Bookmarks("RReason2").Range.Delete
End If

Dim PropID2 As Range
Set PropID2 = ActiveDocument.Bookmarks("Prop2ID").Range
PropID2.Text = Me.TextBox18.Value

If OptionButton21.Value = True Then
Dim Re21 As Range
Set Re21 = ActiveDocument.Bookmarks("Prop2Re").Range
Re21.Text = "Lease"
ActiveDocument.Bookmarks("D18").Range.Delete
ActiveDocument.Bookmarks("D20").Range.Delete
ActiveDocument.Bookmarks("D19").Range.Delete
ActiveDocument.Bookmarks("D21").Range.Delete
ActiveDocument.Bookmarks("D22").Range.Delete
ActiveDocument.Bookmarks("D23").Range.Delete
ActiveDocument.Bookmarks("D25").Range.Delete
End If
If OptionButton21.Value = True And ComboBox3.Value <> "QLD" Then
ActiveDocument.Bookmarks("D15").Range.Delete
ActiveDocument.Bookmarks("D24").Range.Delete
End If
If OptionButton21.Value = True And ComboBox3.Value <> "NT" Then
ActiveDocument.Bookmarks("D16").Range.Delete
End If
If OptionButton21.Value = True And ComboBox3.Value <> "NSW" Then
ActiveDocument.Bookmarks("D17").Range.Delete
End If
If OptionButton21.Value = True And ComboBox3.Value = "QLD" Then
ActiveDocument.Bookmarks("D14").Range.Delete
End If
If OptionButton21.Value = True And ComboBox3.Value = "NT" Then
ActiveDocument.Bookmarks("D14").Range.Delete
End If
If OptionButton22.Value = True Then
Dim Re22 As Range
Set Re22 = ActiveDocument.Bookmarks("Prop2Re").Range
Re22.Text = "Lease and Variation/s"
ActiveDocument.Bookmarks("D18").Range.Delete
ActiveDocument.Bookmarks("D21").Range.Delete
ActiveDocument.Bookmarks("D22").Range.Delete
ActiveDocument.Bookmarks("D23").Range.Delete
ActiveDocument.Bookmarks("D25").Range.Delete
End If
If OptionButton22.Value = True And ComboBox3.Value <> "QLD" Then
ActiveDocument.Bookmarks("D15").Range.Delete
ActiveDocument.Bookmarks("D20").Range.Delete
ActiveDocument.Bookmarks("D24").Range.Delete
End If
If OptionButton22.Value = True And ComboBox3.Value <> "NT" Then
ActiveDocument.Bookmarks("D16").Range.Delete
End If
If OptionButton22.Value = True And ComboBox3.Value <> "NSW" Then
ActiveDocument.Bookmarks("D17").Range.Delete
End If
If OptionButton22.Value = True And ComboBox3.Value = "QLD" Then
ActiveDocument.Bookmarks("D14").Range.Delete
ActiveDocument.Bookmarks("D19").Range.Delete
End If
If OptionButton22.Value = True And ComboBox3.Value = "NT" Then
ActiveDocument.Bookmarks("D14").Range.Delete
End If
If OptionButton23.Value = True Then
Dim Re23 As Range
Set Re23 = ActiveDocument.Bookmarks("Prop2Re").Range
Re23.Text = "Variation of Lease or Sublease"
ActiveDocument.Bookmarks("D14").Range.Delete
ActiveDocument.Bookmarks("D15").Range.Delete
ActiveDocument.Bookmarks("D16").Range.Delete
ActiveDocument.Bookmarks("D17").Range.Delete
ActiveDocument.Bookmarks("D18").Range.Delete
ActiveDocument.Bookmarks("D21").Range.Delete
ActiveDocument.Bookmarks("D22").Range.Delete
ActiveDocument.Bookmarks("D23").Range.Delete
End If
If OptionButton23.Value = True And ComboBox3.Value <> "QLD" Then
ActiveDocument.Bookmarks("D20").Range.Delete
ActiveDocument.Bookmarks("D24").Range.Delete
End If
If OptionButton23.Value = True And ComboBox3.Value = "QLD" Then
ActiveDocument.Bookmarks("D19").Range.Delete
End If

If OptionButton24.Value = True Then
Dim Re24 As Range
Set Re24 = ActiveDocument.Bookmarks("Prop2Re").Range
Re24.Text = "Agreement for Lease"
ActiveDocument.Bookmarks("D14").Range.Delete
ActiveDocument.Bookmarks("D15").Range.Delete
ActiveDocument.Bookmarks("D16").Range.Delete
ActiveDocument.Bookmarks("D17").Range.Delete
ActiveDocument.Bookmarks("D19").Range.Delete
ActiveDocument.Bookmarks("D20").Range.Delete
ActiveDocument.Bookmarks("D18").Range.Delete
ActiveDocument.Bookmarks("D22").Range.Delete
ActiveDocument.Bookmarks("D23").Range.Delete
ActiveDocument.Bookmarks("D25").Range.Delete
ActiveDocument.Bookmarks("D24").Range.Delete
End If
If OptionButton29.Value = True Then
Dim Re25 As Range
Set Re25 = ActiveDocument.Bookmarks("Prop2Re").Range
Re25.Text = "Lease and Agreement for Lease"
ActiveDocument.Bookmarks("D18").Range.Delete
ActiveDocument.Bookmarks("D20").Range.Delete
ActiveDocument.Bookmarks("D19").Range.Delete
ActiveDocument.Bookmarks("D22").Range.Delete
ActiveDocument.Bookmarks("D23").Range.Delete
ActiveDocument.Bookmarks("D25").Range.Delete
End If
If OptionButton29.Value = True And ComboBox3.Value <> "QLD" Then
ActiveDocument.Bookmarks("D15").Range.Delete
ActiveDocument.Bookmarks("D24").Range.Delete
End If
If OptionButton29.Value = True And ComboBox3.Value <> "NT" Then
ActiveDocument.Bookmarks("D16").Range.Delete
End If
If OptionButton29.Value = True And ComboBox3.Value <> "NSW" Then
ActiveDocument.Bookmarks("D17").Range.Delete
End If
If OptionButton29.Value = True And ComboBox3.Value = "QLD" Then
ActiveDocument.Bookmarks("D14").Range.Delete
End If
If OptionButton29.Value = True And ComboBox3.Value = "NT" Then
ActiveDocument.Bookmarks("D14").Range.Delete
End If

If OptionButton25.Value = True Then
Dim Re26 As Range
Set Re26 = ActiveDocument.Bookmarks("Prop2Re").Range
Re26.Text = "Sublease"
ActiveDocument.Bookmarks("D14").Range.Delete
ActiveDocument.Bookmarks("D15").Range.Delete
ActiveDocument.Bookmarks("D16").Range.Delete
ActiveDocument.Bookmarks("D17").Range.Delete
ActiveDocument.Bookmarks("D19").Range.Delete
ActiveDocument.Bookmarks("D20").Range.Delete
ActiveDocument.Bookmarks("D21").Range.Delete
ActiveDocument.Bookmarks("D22").Range.Delete
ActiveDocument.Bookmarks("D23").Range.Delete
End If
If OptionButton25.Value = True And ComboBox3.Value <> "QLD" Then
ActiveDocument.Bookmarks("D24").Range.Delete
End If
If OptionButton28.Value = True Then
Dim Re27 As Range
Set Re27 = ActiveDocument.Bookmarks("Prop2Re").Range
Re27.Text = "Lease and Sublease"
ActiveDocument.Bookmarks("D20").Range.Delete
ActiveDocument.Bookmarks("D19").Range.Delete
ActiveDocument.Bookmarks("D21").Range.Delete
ActiveDocument.Bookmarks("D22").Range.Delete
ActiveDocument.Bookmarks("D23").Range.Delete
ActiveDocument.Bookmarks("D25").Range.Delete
End If
If OptionButton28.Value = True And ComboBox3.Value <> "QLD" Then
ActiveDocument.Bookmarks("D15").Range.Delete
ActiveDocument.Bookmarks("D24").Range.Delete
End If
If OptionButton28.Value = True And ComboBox3.Value <> "NT" Then
ActiveDocument.Bookmarks("D16").Range.Delete
End If
If OptionButton28.Value = True And ComboBox3.Value <> "NSW" Then
ActiveDocument.Bookmarks("D17").Range.Delete
End If
If OptionButton28.Value = True And ComboBox3.Value = "QLD" Then
ActiveDocument.Bookmarks("D14").Range.Delete
End If
If OptionButton28.Value = True And ComboBox3.Value = "NT" Then
ActiveDocument.Bookmarks("D14").Range.Delete
End If

If OptionButton26.Value = True Then
Dim Re28 As Range
Set Re28 = ActiveDocument.Bookmarks("Prop2Re").Range
Re28.Text = "Transfer or Assignment of Lease or Sublease"
ActiveDocument.Bookmarks("D14").Range.Delete
ActiveDocument.Bookmarks("D15").Range.Delete
ActiveDocument.Bookmarks("D16").Range.Delete
ActiveDocument.Bookmarks("D17").Range.Delete
ActiveDocument.Bookmarks("D18").Range.Delete
ActiveDocument.Bookmarks("D19").Range.Delete
ActiveDocument.Bookmarks("D20").Range.Delete
ActiveDocument.Bookmarks("D21").Range.Delete
ActiveDocument.Bookmarks("D23").Range.Delete
End If
If OptionButton26.Value = True And ComboBox3.Value <> "QLD" Then
ActiveDocument.Bookmarks("D24").Range.Delete
End If

If OptionButton27.Value = True Then
Dim Re29 As Range
Set Re29 = ActiveDocument.Bookmarks("Prop2Re").Range
Re29.Text = "Surrender or Request for Determination of Lease or Sublease"
ActiveDocument.Bookmarks("D14").Range.Delete
ActiveDocument.Bookmarks("D15").Range.Delete
ActiveDocument.Bookmarks("D16").Range.Delete
ActiveDocument.Bookmarks("D17").Range.Delete
ActiveDocument.Bookmarks("D18").Range.Delete
ActiveDocument.Bookmarks("D19").Range.Delete
ActiveDocument.Bookmarks("D20").Range.Delete
ActiveDocument.Bookmarks("D21").Range.Delete
ActiveDocument.Bookmarks("D22").Range.Delete
ActiveDocument.Bookmarks("D25").Range.Delete
End If
If OptionButton27.Value = True And ComboBox3.Value <> "QLD" Then
ActiveDocument.Bookmarks("D24").Range.Delete
End If

If OptionButton32.Value = True Then
Dim Reason2 As Range
Set Reason2 = ActiveDocument.Bookmarks("Reason2").Range
Reason2.Text = "NAB as existing Mortgagee (Consent Requested)"
End If
If OptionButton33.Value = True Then
Dim Reason22 As Range
Set Reason22 = ActiveDocument.Bookmarks("Reason2").Range
Reason22.Text = "NAB as proposed Mortgagee"
End If
If OptionButton34.Value = True Then
Dim Reason222 As Range
Set Reason222 = ActiveDocument.Bookmarks("Reason2").Range
Reason222.Text = "Rights of the Lessee - Not taking a mortgage of Lease"
End If

If OptionButton30.Value = True Then
Dim SMSFY2 As Range
Set SMSFY2 = ActiveDocument.Bookmarks("SMSF2").Range
SMSFY2.Text = "Yes"
End If
If OptionButton31.Value = True Then
Dim SMSFN2 As Range
Set SMSFN2 = ActiveDocument.Bookmarks("SMSF2").Range
SMSFN2.Text = "No"
End If
If OptionButton31.Value = True Then
ActiveDocument.Bookmarks("D26").Range.Delete
End If

If OptionButton20.Value = True Then
Dim LL2 As Range
Set LLY2 = ActiveDocument.Bookmarks("LL2").Range
LLY2.Text = "Yes"
End If
If OptionButton19.Value = True Then
Dim LLN2 As Range
Set LLN2 = ActiveDocument.Bookmarks("LL2").Range
LLN2.Text = "No"
End If

If CheckBox2.Value <> True Then
ActiveDocument.Bookmarks("Lease3").Range.Delete
ActiveDocument.Bookmarks("LLL3").Range.Delete
ActiveDocument.Bookmarks("SSMSF3").Range.Delete
ActiveDocument.Bookmarks("RReason3").Range.Delete
End If

Dim PropID3 As Range
Set PropID3 = ActiveDocument.Bookmarks("Prop3ID").Range
PropID3.Text = Me.TextBox20.Value

If OptionButton37.Value = True Then
Dim Re31 As Range
Set Re31 = ActiveDocument.Bookmarks("Prop3Re").Range
Re31.Text = "Lease"
ActiveDocument.Bookmarks("D27").Range.Delete
ActiveDocument.Bookmarks("D33").Range.Delete
ActiveDocument.Bookmarks("D32").Range.Delete
ActiveDocument.Bookmarks("D34").Range.Delete
ActiveDocument.Bookmarks("D35").Range.Delete
ActiveDocument.Bookmarks("D36").Range.Delete
ActiveDocument.Bookmarks("D38").Range.Delete
End If
If OptionButton37.Value = True And ComboBox4.Value <> "QLD" Then
ActiveDocument.Bookmarks("D28").Range.Delete
ActiveDocument.Bookmarks("D37").Range.Delete
End If
If OptionButton37.Value = True And ComboBox4.Value <> "NT" Then
ActiveDocument.Bookmarks("D29").Range.Delete
End If
If OptionButton37.Value = True And ComboBox4.Value <> "NSW" Then
ActiveDocument.Bookmarks("D30").Range.Delete
End If
If OptionButton37.Value = True And ComboBox4.Value = "QLD" Then
ActiveDocument.Bookmarks("D27").Range.Delete
End If
If OptionButton37.Value = True And ComboBox4.Value = "NT" Then
ActiveDocument.Bookmarks("D27").Range.Delete
End If
If OptionButton38.Value = True Then
Dim Re32 As Range
Set Re32 = ActiveDocument.Bookmarks("Prop3Re").Range
Re32.Text = "Lease and Variation/s"
ActiveDocument.Bookmarks("D31").Range.Delete
ActiveDocument.Bookmarks("D34").Range.Delete
ActiveDocument.Bookmarks("D35").Range.Delete
ActiveDocument.Bookmarks("D36").Range.Delete
ActiveDocument.Bookmarks("D38").Range.Delete
End If
If OptionButton38.Value = True And ComboBox4.Value <> "QLD" Then
ActiveDocument.Bookmarks("D28").Range.Delete
ActiveDocument.Bookmarks("D33").Range.Delete
ActiveDocument.Bookmarks("D37").Range.Delete
End If
If OptionButton38.Value = True And ComboBox4.Value <> "NT" Then
ActiveDocument.Bookmarks("D29").Range.Delete
End If
If OptionButton38.Value = True And ComboBox4.Value <> "NSW" Then
ActiveDocument.Bookmarks("D30").Range.Delete
End If
If OptionButton38.Value = True And ComboBox4.Value = "QLD" Then
ActiveDocument.Bookmarks("D27").Range.Delete
ActiveDocument.Bookmarks("D32").Range.Delete
End If
If OptionButton38.Value = True And ComboBox4.Value = "NT" Then
ActiveDocument.Bookmarks("D27").Range.Delete
End If
If OptionButton39.Value = True Then
Dim Re33 As Range
Set Re33 = ActiveDocument.Bookmarks("Prop3Re").Range
Re33.Text = "Variation of Lease or Sublease"
ActiveDocument.Bookmarks("D27").Range.Delete
ActiveDocument.Bookmarks("D28").Range.Delete
ActiveDocument.Bookmarks("D29").Range.Delete
ActiveDocument.Bookmarks("D30").Range.Delete
ActiveDocument.Bookmarks("D31").Range.Delete
ActiveDocument.Bookmarks("D34").Range.Delete
ActiveDocument.Bookmarks("D35").Range.Delete
ActiveDocument.Bookmarks("D36").Range.Delete
End If
If OptionButton39.Value = True And ComboBox4.Value <> "QLD" Then
ActiveDocument.Bookmarks("D33").Range.Delete
ActiveDocument.Bookmarks("D37").Range.Delete
End If
If OptionButton39.Value = True And ComboBox4.Value = "QLD" Then
ActiveDocument.Bookmarks("D32").Range.Delete
End If

If OptionButton40.Value = True Then
Dim Re34 As Range
Set Re34 = ActiveDocument.Bookmarks("Prop3Re").Range
Re34.Text = "Agreement for Lease"
ActiveDocument.Bookmarks("D27").Range.Delete
ActiveDocument.Bookmarks("D28").Range.Delete
ActiveDocument.Bookmarks("D29").Range.Delete
ActiveDocument.Bookmarks("D30").Range.Delete
ActiveDocument.Bookmarks("D32").Range.Delete
ActiveDocument.Bookmarks("D33").Range.Delete
ActiveDocument.Bookmarks("D31").Range.Delete
ActiveDocument.Bookmarks("D35").Range.Delete
ActiveDocument.Bookmarks("D36").Range.Delete
ActiveDocument.Bookmarks("D38").Range.Delete
ActiveDocument.Bookmarks("D37").Range.Delete
End If
If OptionButton45.Value = True Then
Dim Re35 As Range
Set Re35 = ActiveDocument.Bookmarks("Prop3Re").Range
Re35.Text = "Lease and Agreement for Lease"
ActiveDocument.Bookmarks("D31").Range.Delete
ActiveDocument.Bookmarks("D33").Range.Delete
ActiveDocument.Bookmarks("D32").Range.Delete
ActiveDocument.Bookmarks("D35").Range.Delete
ActiveDocument.Bookmarks("D36").Range.Delete
ActiveDocument.Bookmarks("D38").Range.Delete
End If
If OptionButton45.Value = True And ComboBox4.Value <> "QLD" Then
ActiveDocument.Bookmarks("D28").Range.Delete
ActiveDocument.Bookmarks("D37").Range.Delete
End If
If OptionButton45.Value = True And ComboBox4.Value <> "NT" Then
ActiveDocument.Bookmarks("D29").Range.Delete
End If
If OptionButton45.Value = True And ComboBox4.Value <> "NSW" Then
ActiveDocument.Bookmarks("D30").Range.Delete
End If
If OptionButton45.Value = True And ComboBox4.Value = "QLD" Then
ActiveDocument.Bookmarks("D27").Range.Delete
End If
If OptionButton45.Value = True And ComboBox4.Value = "NT" Then
ActiveDocument.Bookmarks("D27").Range.Delete
End If

If OptionButton41.Value = True Then
Dim Re36 As Range
Set Re36 = ActiveDocument.Bookmarks("Prop3Re").Range
Re36.Text = "Sublease"
ActiveDocument.Bookmarks("D27").Range.Delete
ActiveDocument.Bookmarks("D28").Range.Delete
ActiveDocument.Bookmarks("D29").Range.Delete
ActiveDocument.Bookmarks("D30").Range.Delete
ActiveDocument.Bookmarks("D32").Range.Delete
ActiveDocument.Bookmarks("D33").Range.Delete
ActiveDocument.Bookmarks("D34").Range.Delete
ActiveDocument.Bookmarks("D35").Range.Delete
ActiveDocument.Bookmarks("D36").Range.Delete
End If
If OptionButton41.Value = True And ComboBox4.Value <> "QLD" Then
ActiveDocument.Bookmarks("D37").Range.Delete
End If
If OptionButton44.Value = True Then
Dim Re37 As Range
Set Re37 = ActiveDocument.Bookmarks("Prop3Re").Range
Re37.Text = "Lease and Sublease"
ActiveDocument.Bookmarks("D33").Range.Delete
ActiveDocument.Bookmarks("D32").Range.Delete
ActiveDocument.Bookmarks("D34").Range.Delete
ActiveDocument.Bookmarks("D35").Range.Delete
ActiveDocument.Bookmarks("D36").Range.Delete
ActiveDocument.Bookmarks("D38").Range.Delete
End If
If OptionButton44.Value = True And ComboBox4.Value <> "QLD" Then
ActiveDocument.Bookmarks("D28").Range.Delete
ActiveDocument.Bookmarks("D37").Range.Delete
End If
If OptionButton44.Value = True And ComboBox4.Value <> "NT" Then
ActiveDocument.Bookmarks("D29").Range.Delete
End If
If OptionButton44.Value = True And ComboBox4.Value <> "NSW" Then
ActiveDocument.Bookmarks("D30").Range.Delete
End If
If OptionButton44.Value = True And ComboBox4.Value = "QLD" Then
ActiveDocument.Bookmarks("D27").Range.Delete
End If
If OptionButton44.Value = True And ComboBox4.Value = "NT" Then
ActiveDocument.Bookmarks("D27").Range.Delete
End If

If OptionButton42.Value = True Then
Dim Re38 As Range
Set Re38 = ActiveDocument.Bookmarks("Prop3Re").Range
Re38.Text = "Transfer or Assignment of Lease or Sublease"
ActiveDocument.Bookmarks("D27").Range.Delete
ActiveDocument.Bookmarks("D28").Range.Delete
ActiveDocument.Bookmarks("D29").Range.Delete
ActiveDocument.Bookmarks("D30").Range.Delete
ActiveDocument.Bookmarks("D31").Range.Delete
ActiveDocument.Bookmarks("D32").Range.Delete
ActiveDocument.Bookmarks("D33").Range.Delete
ActiveDocument.Bookmarks("D34").Range.Delete
ActiveDocument.Bookmarks("D36").Range.Delete
End If
If OptionButton42.Value = True And ComboBox4.Value <> "QLD" Then
ActiveDocument.Bookmarks("D37").Range.Delete
End If

If OptionButton43.Value = True Then
Dim Re39 As Range
Set Re39 = ActiveDocument.Bookmarks("Prop3Re").Range
Re39.Text = "Surrender or Request for Determination of Lease or Sublease"
ActiveDocument.Bookmarks("D27").Range.Delete
ActiveDocument.Bookmarks("D28").Range.Delete
ActiveDocument.Bookmarks("D29").Range.Delete
ActiveDocument.Bookmarks("D30").Range.Delete
ActiveDocument.Bookmarks("D31").Range.Delete
ActiveDocument.Bookmarks("D32").Range.Delete
ActiveDocument.Bookmarks("D33").Range.Delete
ActiveDocument.Bookmarks("D34").Range.Delete
ActiveDocument.Bookmarks("D35").Range.Delete
ActiveDocument.Bookmarks("D38").Range.Delete
End If
If OptionButton43.Value = True And ComboBox4.Value <> "QLD" Then
ActiveDocument.Bookmarks("D37").Range.Delete
End If

If OptionButton48.Value = True Then
Dim Reason3 As Range
Set Reason3 = ActiveDocument.Bookmarks("Reason3").Range
Reason3.Text = "NAB as existing Mortgagee (Consent Requested)"
End If
If OptionButton49.Value = True Then
Dim Reason33 As Range
Set Reason33 = ActiveDocument.Bookmarks("Reason3").Range
Reason33.Text = "NAB as proposed Mortgagee"
End If
If OptionButton50.Value = True Then
Dim Reason333 As Range
Set Reason333 = ActiveDocument.Bookmarks("Reason3").Range
Reason333.Text = "Rights of the Lessee - Not taking a mortgage of Lease"
End If

If OptionButton46.Value = True Then
Dim SMSFY3 As Range
Set SMSFY3 = ActiveDocument.Bookmarks("SMSF3").Range
SMSFY3.Text = "Yes"
End If
If OptionButton47.Value = True Then
Dim SMSFN3 As Range
Set SMSFN3 = ActiveDocument.Bookmarks("SMSF3").Range
SMSFN3.Text = "No"
End If
If OptionButton47.Value = True Then
ActiveDocument.Bookmarks("D39").Range.Delete
End If

If OptionButton36.Value = True Then
Dim LL3 As Range
Set LLY3 = ActiveDocument.Bookmarks("LL3").Range
LLY3.Text = "Yes"
End If
If OptionButton35.Value = True Then
Dim LLN3 As Range
Set LLN3 = ActiveDocument.Bookmarks("LL3").Range
LLN3.Text = "No"
End If

If OptionButton7.Value = False And OptionButton32.Value = False And OptionButton48.Value = False Then
ActiveDocument.Bookmarks("MortgageeConsent").Range.Delete
End If

Dim Comments As Range
Set Comments = ActiveDocument.Bookmarks("Comments").Range
Comments.Text = Me.TextBox14.Value

ActiveDocument.Protect Type:=wdAllowOnlyReading, NoReset:=True, Password:=""
ActiveWindow.View.ShadeEditableRanges = False

Me.Repaint
UserForm1.Hide

End Sub





Private Sub UserForm_Initialize()
DTPicker1.Value = Date

TextBox18.Visible = False
Label23.Visible = False
Frame12.Visible = False
Frame13.Visible = False
Frame14.Visible = False
Frame15.Visible = False
Frame11.Visible = False

TextBox20.Visible = False
Label26.Visible = False
Frame17.Visible = False
Frame19.Visible = False
Frame20.Visible = False
Frame18.Visible = False
Frame16.Visible = False
End Sub

gmayor
11-01-2017, 04:42 AM
It would be almost impossible to debug that without access to the template, but if you add Option Explicit to the top of the module and Debug > Compile Project you should get some idea of what might be wrong. I notice you have a DTPicker, which may not be available in your version of Windows and that would certainly cause an error.

Paul_Hossler
11-01-2017, 12:13 PM
@Arronjames -- I added CODE tags for you to highlight and format your macros -- you can use the [#] icon next time and just paste you macro between the
... tags

Aaronjames
11-01-2017, 02:25 PM
Thanks gents for all your help.

I have reformatted it as above, and I have tested it with deleting the date picker and the error still comes up. I don't get any errors with the .docm file just when I template it.

Is it it possible to send it to you Graham and if you get a chance would you mind having a look for me??

gmayor
11-02-2017, 02:22 AM
Can you post a link to the document/template either here or to my web site contact page?

Aaronjames
11-03-2017, 03:14 AM
Thanks Graham, Appreciate your help

gmayor
11-03-2017, 06:02 AM
The document does not contain the macros and userform?

Aaronjames
11-06-2017, 12:36 AM
mmmmm.... it comes up on mine (after i click 'Enable Content') but i will try again 20868

gmayor
11-06-2017, 02:48 AM
It still doesn't have the userform nor the macros. Undoubtedly they are in your normal template. Copy them to the document project.

Aaronjames
11-06-2017, 03:15 AM
Hi Graham, is it possible to email it to you directly? I am unable to attach a dotm. file and the document i am uploading has the Userform when i open it so I'm not sure how else to send it.

sorry for the back and forth.

gmayor
11-06-2017, 04:37 AM
There is no need to attach a template, but you do need to copy the userform and the macro(s) that call(s) it from the template to the document (see red arrows below).

Select the userform and drag and drop it to the document project, which as you can see currently has no userform or modules.

Open the modules dropdown (blue arrow) and drag the module that contains the appropriate macro(s) to the document.


20869

Then save the document and attach it to your post.

If there is no module and userform in the document, sending it directly to me won't make any difference.

Aaronjames
11-06-2017, 04:24 PM
Hopefully 3rd time lucky?

20872

gmayor
11-07-2017, 02:07 AM
Well you managed to get the userform included, :)

I have modified the code and so the attached doesn't produce the startup error. I haven't tested the rest of it, but if it worked before it should still do so. Create new documents from the template and the form will pop up.

Aaronjames
11-08-2017, 02:58 AM
AWESOME!!!!!

Thank you so much Graham for all your help with this and apologizes again for the stupid questions. I have only learnt how to do this from forums and Youtube so not that up with the lingo.

I have a few of these that i can now go and make the same amendments across them all.

Thanks again for your help :)

Aaronjames
11-13-2017, 06:21 PM
Hi Graham,

Sorry to do this to you. I tried your attachment when you first put it up and it worked perfectly. I even made the same changes to a few other ones that i had.

However, now its does not seem to work and is giving me this error at the end.
20946

gmayor
11-13-2017, 10:46 PM
Close and re-open Word then try again. It seems you had a form open.
I have made some changes to get rid of those dozens of named ranges and make the process easier to follow.
I would suggest you also investigate Select Case, but it works as it stands.