Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **'Private Sub Userform_Initialize()
- 'add Title Options to Title list and Pension Factor lists on document open
- ' optGreeting1.Value = True
- ' With CboTitle
- ' .AddItem "Mr"
- ' .AddItem "Mrs"
- ' .AddItem "Ms"
- ' .AddItem "Miss"
- ' .AddItem "Doctor"
- ' .AddItem "Master"
- ' End With
- ' With LstbxPenFact
- ' .AddItem "<6 4"
- ' .AddItem "65-74 5"
- ' .AddItem "75-84 6"
- ' .AddItem "85-94 7"
- ' .AddItem "95+ 14"
- ' End With
- 'End Sub
- Private Sub CalculateTotalincome()
- Dim TxtTotalIncome As Long
- Set TotalIncome = Me.TxtIncome.Value
- TxtTotalIncome = (Me.TxtCentrelink.Value + Me.txtwages.Value + Me.TxtRent.Value +
- Me.TextComSuper.Value + Me.TxtotherInc.Value)
- End Sub
- Private Sub CalculateTotalExpenses()
- Dim TxtTotalExpenses As Long
- Set TotalExpenses = Me.TxtExpenses.Value
- TxtTotalExpenses = (Me.TxtBudget.Value + Me.TxtCapex.Value)
- End Sub
- Private Sub CboTitle_Change()
- End Sub
- 'Clear data in userform
- Unload Me
- ActiveDocument.Close SaveChanges:=False
- End Sub
- Private Sub Age_Click()
- Dim TxtAge As Range
- Set Me.TxtAge = Date - Me.TxtDOB
- ' Calculate age as Today's date - The Clients Birthdate.
- dtmDate = Date
- dhAge = DateDiff("yyyy", dtmBD, dtmDate) + (dtmDate < DateSerial(Year(dtmDate), Month (dtmBD), Day(dtmBD)))
- End Sub
- Private Sub CmdAle_Click()
- 'Vlookup Average lifeexpectancy tables in excel table
- Dim EndorsebudWS As String
- Set EndorsebudWS = "S:WorkgroupWorksheets[Endorsebud.xlsx]"
- Me.TxtAle.Value = "=VLOOKUP(,A4'" & FileName1 & "LE'!$A"
- Range1 = Endorsebud.Sheets(LE).Range("A4:C113")
- myValue = Application.WorksheetFunction.VLookup("Ale", Range1, 2, False)
- End Sub
- Private Sub CmdTAGFees_Click()
- 'Calculate 1.1% of Financial Investments
- Dim TxtInvestments As Long
- Dim TxtTagFees As Long
- Set ClientAssets = Me.TxtInvestments.Value
- TxtTagFees = ClientAssets * 1.1 / 100
- End Sub
- Private Sub CmdSubmit_Click()
- 'replace bookmarks with userform values
- Dim Title As Range
- Set Title = ActiveDocument.Bookmarks("title").Range
- Title Text = Me.CboTitl.Value
- Dim ClientName As Range
- Set ClientName = ActiveDocument.Bookmarks("ClientName").Range
- ClientName Text = Me.TxtClientName.Value
- Dim ClientNumber As Range
- Set ClientNumber = ActiveDocument.Bookmarks("ClientNumber").Range
- ClientNumber Text = Me.TxtClientNumber.Value
- Dim ClientNumber2 As Range
- Set ClientNumber2 = ActiveDocument.Bookmarks("ClientNumber2").Range
- ClientNumber2 Text = Me.TxtClientNumber.Value
- Dim Age As Range
- Set Age = ActiveDocument.Bookmarks("Age").Range
- Age Text = Me.TxtAge.Value
- Dim DoB As Range
- Set DoB = ActiveDocument.Bookmarks("DoB").Range
- DoB Text = Me.TxtDOB.Value
- Dim Ale As Range
- Set Ale = ActiveDocument.Bookmarks("Ale").Range
- Ale Text = Me.TxtAle.Value
- Dim FmoDate As Range
- Set FmoDate = ActiveDocument.Bookmarks("FmoDate").Range
- FmoDate Text = Me.TxtFmoDate.Value
- Dim TotlAssets As Range
- Set TotalAssets = ActiveDocument.Bookmarks("TotlAssets").Range
- TotAssets Text = Me.TxtInvestments.Value
- Dim TotlAssets2 As Range
- Set TotalAssets2 = ActiveDocument.Bookmarks("TotlAssets").Range
- TotAssets2 Text = Me.TxtInvestments.Value
- Dim InvestmentAssets As Range
- Set InvestmentAssets = ActiveDocument.Bookmarks("InvestmentAssets").Range
- InvestmentAssets Text = Me.TxtInvestments.Value
- Dim TrustAccount As Range
- Set TrustAccount = ActiveDocument.Bookmarks("TrustAccount").Range
- TrustAccount Text = Me.TxtTrustAc.Value
- Dim TrustAccount2 As Range
- Set TrustAccount2 = ActiveDocument.Bookmarks("TrustAccount2").Range
- TrustAccount2 Text = Me.TxtTrustAc.Value
- Dim LastYearsExpenses As Range
- Set LastYearsExpenses = ActiveDocument.Bookmarks("LastYearsExpenses").Range
- LastYearsExpenses Text = Me.TxtPriorex.Value
- Dim PriorBudget As Range
- Set PriorBudget = ActiveDocument.Bookmarks("PriorBudget").Range
- PriorBudget Text = Me.txtPriorBudg.Value
- Dim CentrelinkIncome As Range
- Set CentrelinkIncome = ActiveDocument.Bookmarks("CentrelinkIncome").Range
- CentrelinkIncome Text = Me.TxtCentrelink.Value
- Dim AnlCentrelink As Range
- Set AnlCentrelink = ActiveDocument.Bookmarks("AnlCentrelink").Range
- AnlCentrelink Text = Me.TxtCentrelink.Value
- Dim SuperIncome As Range
- Set SuperIncome = ActiveDocument.Bookmarks("SuperIncome").Range
- SuperIncome Text = Me.TxtComSuper.Value
- Dim AnnuityIncome As Range
- Set AnnuityIncome = ActiveDocument.Bookmarks("AnnuityIncome").Range
- AnnuityIncome Text = Me.TxtOther.Value
- Dim rentalIncome As Range
- Set rentalIncome = ActiveDocument.Bookmarks("Rental Income").Range
- rentalIncome Text = Me.TxtRent.Value
- Dim TotalanlIncome As Range
- Set TotalanlIncome = ActiveDocument.Bookmarks("TotalanlIncome ").Range
- TotalanlIncome Text = Me.TxtIncomeTotal.Value
- Dim CurrentBudget As Range
- Set CurrentBudget = ActiveDocument.Bookmarks("CurrentBudget").Range
- CurrentBudget Text = Me.TxtBudget.Value
- Dim CurrentBudget2 As Range
- Set CurrentBudget2 = ActiveDocument.Bookmarks("CurrentBudget2").Range
- CurrentBudget2 Text = Me.TxtBudget.Value
- Dim Oneoffex As Range
- Set Oneoffex = ActiveDocument.Bookmarks("Oneoffex").Range
- Oneoffex Text = Me.TxtCapex.Value
- Dim Oneofex As Range
- Set Oneofex = ActiveDocument.Bookmarks("Oneofex").Range
- Oneofex Text = Me.TxtCapex.Value
- Dim Tagfees As Range
- Set Tagfees = ActiveDocument.Bookmarks("Tagfees").Range
- Tagfees Text = Me.TxtTagFees.Value
- Dim BudgetPeriod As Range
- Set BudgetPeriod = ActiveDocument.Bookmarks("BudgetPeriod").Range
- BudgetPeriod Text = Me.TxtBudgPeriod.Value
- 'Calculate todays date
- Dim Todaysdate As Range
- Set Todaysdate = ActiveDocument.Bookmarks("Todaysdate").Range
- Todaysdate Text = Today()
- 'calculate Cash Flow residual from Total Income-Total Expenses
- Dim BudgetResidual As Range
- Set BudgetResididual = ActiveDocument.Bookmarks("BudgetResidual").Range
- BudgetResidual Text = Me.TxtTotalIncome.Value - Me.TxtTotalIncome.Value
- Dim CashflowResidual As Range
- Set cashflowResididual = ActiveDocument.Bookmarks("CashflowResidual").Range
- CashflowResidual Text = BudgetResidual.Value
- Dim ABPInc As Range
- Set ABPInc = ActiveDocument.Bookmarks("ABPInc").Range
- ABPInc Text = Me.TxtABPen * Me.LstbxPenFact
- Dim ABPIncome As Range
- Set ABPIncome = ActiveDocument.Bookmarks("ABPIncome").Range
- ABPIncome Text = ActiveDocument.Bookmarks("ABPInc").Value
- 'Calculate Living Expenses from others
- Dim LivingExps As Range
- Set LivingExps = ActiveDocument.Bookmarks("LivingExp").Range
- LivingExps Text = Me.TxtBudget - (Me.TxtTagFees + Me.TxtCapex)
- 'Calculate Operating Expenses from LivingExp
- Dim OpEx As Range
- Set OpEx = ActiveDocument.Bookmarks("OpExp").Range
- OpEx Text = ActiveDocument.Range("LivingExps") + Me.TxtTagFees
- Dim NetOpRt As Range
- Set NetOpRt = ActiveDocument.Bookmarks("NetOpRt").Range
- NetOpRt Text = (Me.TxtCapex - Me.TxtTotlIncome) / (Me.TxtInvestments - Me.TxtCapex)
- Dim NetEx As Range
- Set NetEx = ActiveDocument.Bookmarks("NetEx").Range
- NetEx Text = Me.TxtTotalExpenses - Me.TxtTotlIncome / Me.TxtInvestments
- Dim GrossEx As Range
- Set GrossEx = ActiveDocument.Bookmarks("GrossEx").Range
- GrossEx = Me.TxtBudget / Me.TxtInvestments
- End Sub
- Private Sub CmdCreateLocalCopy_Click() '(ByVal Item As Object, Cancel As Boolean)
- Call SaveACopy(Endorsebud)
- Const olMsg As Long = 3
- Dim m As MailItem
- Dim savePath As String
- If TypeName(Item) <> "MailItem" Then Exit Sub
- Set m = Item
- savePath = "c:usersyour_user_namedesktop" 'Change this to real path
- savePath = savePath & m.Subject & Format(Now(), "yyyy-mm-dd-hhNNss")
- savePath = savePath & ".msg"
- m.SaveAs savePath, olMsg
- End Sub
- Private Sub TxtTotalExpenses_Change()
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement