P
PumaMan
I have a UserForm in Excel '03 where I am collecting data. I'd like to open a
word template and pass the data on to the template to bookmarks. I'd like to
bypass the process of sending the data to excel cells, then have the data
passed on to the template.
Is that the best way to do it? I assumed it would be faster...but I'm just
starting to learn.
As always, I appreciate the help!
Private Sub BusinessOptionButton_Click()
'Navigate to Business Menu
If Me.BusinessOptionButton.Value = True Then
MultiPage1.BusMainMenu.Visible = True
MultiPage1.Value = 1
MultiPage1.PersMainMenu.Visible = False
Me.PersonalOptionButton.Value = False
End If
End Sub
Private Sub PersonalOptionButton_Click()
'Navigate to Personal Menu
If Me.PersonalOptionButton.Value = True Then
MultiPage1.PersMainMenu.Visible = True
MultiPage1.Value = 0
MultiPage1.BusMainMenu.Visible = False
Me.BusinessOptionButton.Value = False
End If
End Sub
Public Sub UserForm_Activate()
'Sets value to 0 for main page
MultiPage1.Value = 0
' Populates Citizenship Combo Box Data Selection
With CitizenshipComboBox
.AddItem "U.S."
.AddItem "RA"
.AddItem "NRA"
End With
ProcessDocsUserForm.CitizenshipComboBox.ListIndex = 0
' Populates Personal Account Type Combo Box Data Selection
With AccountTypeComboBox
.AddItem "SELECT..."
.AddItem "MYACCESS CHECKING"
.AddItem "REGULAR CHECKING"
.AddItem "INTEREST CHECKING"
.AddItem "CAMPUS EDGE CHECKING"
.AddItem "REGULAR SAVINGS"
.AddItem "UTMA - REGULAR SAVINGS"
.AddItem "MONEY MARKET SAVINGS"
.AddItem "BALANCE REWARDS MONEY MARKET SAVINGS"
End With
ProcessDocsUserForm.AccountTypeComboBox.ListIndex = 0
'Populates State ComboBox Data Selection
With StateComboBox
.AddItem "SELECT STATE..."
.AddItem "ARIZONA"
.AddItem "ARKANSAS"
.AddItem "CONNECTICUT"
.AddItem "DISTRICT OF COLUMBIA"
.AddItem "FLORIDA"
.AddItem "GEORGIA"
.AddItem "ILLINOIS"
.AddItem "INDIANA"
.AddItem "IOWA"
.AddItem "KANSAS"
.AddItem "MAINE"
.AddItem "MARYLAND"
.AddItem "MASSACHUSETTS"
.AddItem "MICHIGAN"
.AddItem "MISSOURI"
.AddItem "NEVADA"
.AddItem "NEW HAMPSHIRE"
.AddItem "NEW JERSEY"
.AddItem "NEW MEXIC"
.AddItem "NEW YORK"
.AddItem "NORTH CAROLINA"
.AddItem "OKLAHOMA"
.AddItem "OREGON"
.AddItem "PENNSYLVANIA"
.AddItem "RHODE ISLAND"
.AddItem "SOUTH CAROLINA"
.AddItem "TENNESSEE"
.AddItem "TEXAS"
.AddItem "VIRGINA"
End With
ProcessDocsUserForm.StateComboBox.ListIndex = 0
End Sub
Private Sub GenerateFormsButton_Click()
' Check for valid data before processing
Call ValidData
If ErrorsBoolean = True Then
Exit Sub
End If
' Begin Data transfer to ?
End Sub
Private Function ValidData() As Boolean
' Check for Valid Data
Dim ErrorsBoolean As Boolean
ErrorsBoolean = False
Dim MessageString As String
MessageString = ""
If AddSignerMaintOptionButton.Value = False _
And RemoveSignerMaintOptionButton.Value = False _
And ChangeTitleMaintOptionButton.Value = False _
And ChangeBeneMaintOptionButton.Value = False Then
ErrorsBoolean = True
MsgBox ("Please select a maintenance option")
Exit Function
End If
If AddressTextBox = "" Then
ErrorsBoolean = True
MsgBox ("Enter a Mailing Address!")
Exit Function
ElseIf CaseNumberTextBox.Value = "" Then
End If
If CaseNumberTextBox.Value = "" Then
ErrorsBoolean = True
MsgBox ("Enter a Case Number!")
Exit Function
End If
If StateComboBox.Value = "SELECT STATE..." Then
ErrorsBoolean = True
MsgBox ("Select a valid State!")
Exit Function
End If
If AcctNumberTextBox.Value = "" Then
ErrorsBoolean = True
MsgBox ("Enter an Account Number")
Exit Function
End If
If Not IsNumeric(AcctNumberTextBox) Then
ErrorsBoolean = True
MsgBox ("Account Number MUST be Numeric!")
Exit Function
End If
If AccountTypeComboBox.Value = "SELECT..." Then
ErrorsBoolean = True
MsgBox ("Select a valid Account Type!")
Exit Function
End If
If TitleLine1TextBox.Value = "" Then
ErrorsBoolean = True
MsgBox ("Title Line 1 cannot be empty!")
Exit Function
End If
If TitleLine2TextBox.Value = "" _
And TitleLine3TextBox.Value <> "" Then
ErrorsBoolean = True
MsgBox ("Line 2 should not be empty if Line 3 has data!")
Exit Function
End If
End Function
Private Sub ClearButton_Click()
'Clears the form
If AddSignerMaintOptionButton.Value = True Then
AddSignerMaintOptionButton.Value = False
ElseIf RemoveSignerMaintOptionButton.Value = True Then
RemoveSignerMaintOptionButton.Value = False
ElseIf ChangeTitleMaintOptionButton.Value = True Then
ChangeTitleMaintOptionButton.Value = False
ElseIf ChangeBeneMaintOptionButton.Value = True Then
ChangeBeneMaintOptionButton.Value = False
End If
AddressTextBox.Value = ""
CaseNumberTextBox.Value = ""
ProcessDocsUserForm.CitizenshipComboBox.ListIndex = 0
ProcessDocsUserForm.StateComboBox.ListIndex = 0
ProcessDocsUserForm.AccountTypeComboBox.ListIndex = 0
AcctNumberTextBox.Value = ""
TitleLine1TextBox.Value = ""
TitleLine2TextBox.Value = ""
TitleLine3TextBox.Value = ""
End Sub
Private Sub ExitButton_Click()
'Exit Program
Unload Me
End Sub
word template and pass the data on to the template to bookmarks. I'd like to
bypass the process of sending the data to excel cells, then have the data
passed on to the template.
Is that the best way to do it? I assumed it would be faster...but I'm just
starting to learn.
As always, I appreciate the help!
Private Sub BusinessOptionButton_Click()
'Navigate to Business Menu
If Me.BusinessOptionButton.Value = True Then
MultiPage1.BusMainMenu.Visible = True
MultiPage1.Value = 1
MultiPage1.PersMainMenu.Visible = False
Me.PersonalOptionButton.Value = False
End If
End Sub
Private Sub PersonalOptionButton_Click()
'Navigate to Personal Menu
If Me.PersonalOptionButton.Value = True Then
MultiPage1.PersMainMenu.Visible = True
MultiPage1.Value = 0
MultiPage1.BusMainMenu.Visible = False
Me.BusinessOptionButton.Value = False
End If
End Sub
Public Sub UserForm_Activate()
'Sets value to 0 for main page
MultiPage1.Value = 0
' Populates Citizenship Combo Box Data Selection
With CitizenshipComboBox
.AddItem "U.S."
.AddItem "RA"
.AddItem "NRA"
End With
ProcessDocsUserForm.CitizenshipComboBox.ListIndex = 0
' Populates Personal Account Type Combo Box Data Selection
With AccountTypeComboBox
.AddItem "SELECT..."
.AddItem "MYACCESS CHECKING"
.AddItem "REGULAR CHECKING"
.AddItem "INTEREST CHECKING"
.AddItem "CAMPUS EDGE CHECKING"
.AddItem "REGULAR SAVINGS"
.AddItem "UTMA - REGULAR SAVINGS"
.AddItem "MONEY MARKET SAVINGS"
.AddItem "BALANCE REWARDS MONEY MARKET SAVINGS"
End With
ProcessDocsUserForm.AccountTypeComboBox.ListIndex = 0
'Populates State ComboBox Data Selection
With StateComboBox
.AddItem "SELECT STATE..."
.AddItem "ARIZONA"
.AddItem "ARKANSAS"
.AddItem "CONNECTICUT"
.AddItem "DISTRICT OF COLUMBIA"
.AddItem "FLORIDA"
.AddItem "GEORGIA"
.AddItem "ILLINOIS"
.AddItem "INDIANA"
.AddItem "IOWA"
.AddItem "KANSAS"
.AddItem "MAINE"
.AddItem "MARYLAND"
.AddItem "MASSACHUSETTS"
.AddItem "MICHIGAN"
.AddItem "MISSOURI"
.AddItem "NEVADA"
.AddItem "NEW HAMPSHIRE"
.AddItem "NEW JERSEY"
.AddItem "NEW MEXIC"
.AddItem "NEW YORK"
.AddItem "NORTH CAROLINA"
.AddItem "OKLAHOMA"
.AddItem "OREGON"
.AddItem "PENNSYLVANIA"
.AddItem "RHODE ISLAND"
.AddItem "SOUTH CAROLINA"
.AddItem "TENNESSEE"
.AddItem "TEXAS"
.AddItem "VIRGINA"
End With
ProcessDocsUserForm.StateComboBox.ListIndex = 0
End Sub
Private Sub GenerateFormsButton_Click()
' Check for valid data before processing
Call ValidData
If ErrorsBoolean = True Then
Exit Sub
End If
' Begin Data transfer to ?
End Sub
Private Function ValidData() As Boolean
' Check for Valid Data
Dim ErrorsBoolean As Boolean
ErrorsBoolean = False
Dim MessageString As String
MessageString = ""
If AddSignerMaintOptionButton.Value = False _
And RemoveSignerMaintOptionButton.Value = False _
And ChangeTitleMaintOptionButton.Value = False _
And ChangeBeneMaintOptionButton.Value = False Then
ErrorsBoolean = True
MsgBox ("Please select a maintenance option")
Exit Function
End If
If AddressTextBox = "" Then
ErrorsBoolean = True
MsgBox ("Enter a Mailing Address!")
Exit Function
ElseIf CaseNumberTextBox.Value = "" Then
End If
If CaseNumberTextBox.Value = "" Then
ErrorsBoolean = True
MsgBox ("Enter a Case Number!")
Exit Function
End If
If StateComboBox.Value = "SELECT STATE..." Then
ErrorsBoolean = True
MsgBox ("Select a valid State!")
Exit Function
End If
If AcctNumberTextBox.Value = "" Then
ErrorsBoolean = True
MsgBox ("Enter an Account Number")
Exit Function
End If
If Not IsNumeric(AcctNumberTextBox) Then
ErrorsBoolean = True
MsgBox ("Account Number MUST be Numeric!")
Exit Function
End If
If AccountTypeComboBox.Value = "SELECT..." Then
ErrorsBoolean = True
MsgBox ("Select a valid Account Type!")
Exit Function
End If
If TitleLine1TextBox.Value = "" Then
ErrorsBoolean = True
MsgBox ("Title Line 1 cannot be empty!")
Exit Function
End If
If TitleLine2TextBox.Value = "" _
And TitleLine3TextBox.Value <> "" Then
ErrorsBoolean = True
MsgBox ("Line 2 should not be empty if Line 3 has data!")
Exit Function
End If
End Function
Private Sub ClearButton_Click()
'Clears the form
If AddSignerMaintOptionButton.Value = True Then
AddSignerMaintOptionButton.Value = False
ElseIf RemoveSignerMaintOptionButton.Value = True Then
RemoveSignerMaintOptionButton.Value = False
ElseIf ChangeTitleMaintOptionButton.Value = True Then
ChangeTitleMaintOptionButton.Value = False
ElseIf ChangeBeneMaintOptionButton.Value = True Then
ChangeBeneMaintOptionButton.Value = False
End If
AddressTextBox.Value = ""
CaseNumberTextBox.Value = ""
ProcessDocsUserForm.CitizenshipComboBox.ListIndex = 0
ProcessDocsUserForm.StateComboBox.ListIndex = 0
ProcessDocsUserForm.AccountTypeComboBox.ListIndex = 0
AcctNumberTextBox.Value = ""
TitleLine1TextBox.Value = ""
TitleLine2TextBox.Value = ""
TitleLine3TextBox.Value = ""
End Sub
Private Sub ExitButton_Click()
'Exit Program
Unload Me
End Sub