P
PMuller
I have a complicated userform contained within a template. Once the userform
is completed and the OK command button is selected the userform merges and
populates.
Within the template I have a series of cross references which I would like
updated once the document populates although I'm not sure how to do this as
the form unloads and then the document populates. Can someone please shed
any light on how I might update fields once the template is has populated?
Basically after the following is completed, then I want do something simple
like a print preview so the cross references are populated. I'm just not
certain how to run another macro after hitting OK.
My OK command is as follows:
Private Sub cmdOK_Click()
ActiveDocument.Bookmarks("Ref").Range.Text = txtRef
ActiveDocument.Bookmarks("Sender").Range.Text = txtSender
ActiveDocument.Bookmarks("SendersTitle").Range.Text = txtSTitle
If OptExistingClient = True Then
ActiveDocument.Bookmarks("ClientStatus").Range.Text = "Paragraph 1"
If OptNewClient = True Then
ActiveDocument.Bookmarks("ClientStatus").Range.Text = "Paragraph 2"
If OptARR_FeeEstimate = True Then InsertARR_FeeEstimate
If OptARR_FeeEstimate = False Then RemoveARR_FeeEstimate
If OptARR_HourlyRates = True Then InsertARR_HourlyRates
If OptARR_HourlyRates = False Then RemoveARR_HourlyRates
If OptOtherServices_FeeEstimate = True Then InsertOS_FeeEstimate
If OptOtherServices_FeeEstimate = False Then RemoveOS_FeeEstimate
If OptOtherServices_HourlyRates = True Then InsertOS_HourlyRates
If OptOtherServices_HourlyRates = False Then RemoveOS_HourlyRates
If CheckBoxOS_PreparationPayroll = True Then InsertOS_PreparationPayroll
If CheckBoxOS_PreparationPayroll = False Then RemoveOS_PreparationPayroll
If CheckBoxOS_ReviewWorkersComp = True Then InsertOS_ReviewWorkersComp
If CheckBoxOS_ReviewWorkersComp = False Then RemoveOS_ReviewWorkersComp
If CheckBoxOS_PreparationMonthlyDebtors = True Then
InsertOS_PreparationMonthlyDebtors
If CheckBoxOS_PreparationMonthlyDebtors = False Then
RemoveOS_PreparationMonthlyDebtors
If CheckBoxOS_PreparationFinancialStatements = True Then
InsertOS_PreparationFinancialStatements
If CheckBoxOS_PreparationFinancialStatements = False Then
RemoveOS_PreparationFinancialStatements
If CheckBoxOS_SuccessionPlanning = True Then InsertOS_SuccessionPlanning
If CheckBoxOS_SuccessionPlanning = False Then RemoveOS_SuccessionPlanning
If CheckBoxOS_BusinessRestructure = True Then InsertOS_BusinessRestructure
If CheckBoxOS_BusinessRestructure = False Then RemoveOS_BusinessRestructure
If CheckBoxOS_AccountingBookkeeping = True Then InsertOS_AccountingBookkeeping
If CheckBoxOS_AccountingBookkeeping = False Then
RemoveOS_AccountingBookkeeping
If CheckBoxOS_GeneralBusiness = True Then InsertOS_GeneralBusiness
If CheckBoxOS_GeneralBusiness = False Then RemoveOS_GeneralBusiness
If OptCOBNE = True Then ActiveDocument.Bookmarks("CO_Entity").Range.Text =
"CO Name"
If OptCO = True Then ActiveDocument.Bookmarks("CO_Entity").Range.Text = "CO
Name"
If OptCOCFIN = True Then ActiveDocument.Bookmarks("CO_Entity").Range.Text =
"CO Name CFIN"
If OptCOSEC = True Then ActiveDocument.Bookmarks("CO_Entity").Range.Text =
"CO Name SEC Limited"
If OptCOWM = True Then ActiveDocument.Bookmarks("CO_Entity").Range.Text =
"CO Name WM"
Selection.GoTo What:=wdGoToBookmark, Name:="Body"
Unload Me
End Sub
is completed and the OK command button is selected the userform merges and
populates.
Within the template I have a series of cross references which I would like
updated once the document populates although I'm not sure how to do this as
the form unloads and then the document populates. Can someone please shed
any light on how I might update fields once the template is has populated?
Basically after the following is completed, then I want do something simple
like a print preview so the cross references are populated. I'm just not
certain how to run another macro after hitting OK.
My OK command is as follows:
Private Sub cmdOK_Click()
ActiveDocument.Bookmarks("Ref").Range.Text = txtRef
ActiveDocument.Bookmarks("Sender").Range.Text = txtSender
ActiveDocument.Bookmarks("SendersTitle").Range.Text = txtSTitle
If OptExistingClient = True Then
ActiveDocument.Bookmarks("ClientStatus").Range.Text = "Paragraph 1"
If OptNewClient = True Then
ActiveDocument.Bookmarks("ClientStatus").Range.Text = "Paragraph 2"
If OptARR_FeeEstimate = True Then InsertARR_FeeEstimate
If OptARR_FeeEstimate = False Then RemoveARR_FeeEstimate
If OptARR_HourlyRates = True Then InsertARR_HourlyRates
If OptARR_HourlyRates = False Then RemoveARR_HourlyRates
If OptOtherServices_FeeEstimate = True Then InsertOS_FeeEstimate
If OptOtherServices_FeeEstimate = False Then RemoveOS_FeeEstimate
If OptOtherServices_HourlyRates = True Then InsertOS_HourlyRates
If OptOtherServices_HourlyRates = False Then RemoveOS_HourlyRates
If CheckBoxOS_PreparationPayroll = True Then InsertOS_PreparationPayroll
If CheckBoxOS_PreparationPayroll = False Then RemoveOS_PreparationPayroll
If CheckBoxOS_ReviewWorkersComp = True Then InsertOS_ReviewWorkersComp
If CheckBoxOS_ReviewWorkersComp = False Then RemoveOS_ReviewWorkersComp
If CheckBoxOS_PreparationMonthlyDebtors = True Then
InsertOS_PreparationMonthlyDebtors
If CheckBoxOS_PreparationMonthlyDebtors = False Then
RemoveOS_PreparationMonthlyDebtors
If CheckBoxOS_PreparationFinancialStatements = True Then
InsertOS_PreparationFinancialStatements
If CheckBoxOS_PreparationFinancialStatements = False Then
RemoveOS_PreparationFinancialStatements
If CheckBoxOS_SuccessionPlanning = True Then InsertOS_SuccessionPlanning
If CheckBoxOS_SuccessionPlanning = False Then RemoveOS_SuccessionPlanning
If CheckBoxOS_BusinessRestructure = True Then InsertOS_BusinessRestructure
If CheckBoxOS_BusinessRestructure = False Then RemoveOS_BusinessRestructure
If CheckBoxOS_AccountingBookkeeping = True Then InsertOS_AccountingBookkeeping
If CheckBoxOS_AccountingBookkeeping = False Then
RemoveOS_AccountingBookkeeping
If CheckBoxOS_GeneralBusiness = True Then InsertOS_GeneralBusiness
If CheckBoxOS_GeneralBusiness = False Then RemoveOS_GeneralBusiness
If OptCOBNE = True Then ActiveDocument.Bookmarks("CO_Entity").Range.Text =
"CO Name"
If OptCO = True Then ActiveDocument.Bookmarks("CO_Entity").Range.Text = "CO
Name"
If OptCOCFIN = True Then ActiveDocument.Bookmarks("CO_Entity").Range.Text =
"CO Name CFIN"
If OptCOSEC = True Then ActiveDocument.Bookmarks("CO_Entity").Range.Text =
"CO Name SEC Limited"
If OptCOWM = True Then ActiveDocument.Bookmarks("CO_Entity").Range.Text =
"CO Name WM"
Selection.GoTo What:=wdGoToBookmark, Name:="Body"
Unload Me
End Sub