nickirvine
05-13-2010, 03:42 AM
Hi,
I wonder if anyone can help me.
I'm trying to get a form in word vb.
The idea is you select an option from a dropdown, you press enter, it saves the document and remembers what you entered so next time you don't have to do it again. So next time you are sent to a different form and bypass the dropdown.
This is what I have so far, but it doesn't remember it, when I open a second time its forgot.
This is the button at the end of the form:
Private Sub CommandButton1_Click()
' check that a site is selected
If ComboBox1.Value > "" Then
' if yes then input and save
SavedSite.Value = ComboBox1.Value
SavedSite.Text = ComboBox1.Value
ActiveDocument.Save
' then go to next form
SelectSite.Hide
SelectOption.Show
Else
' if no then ask them to select
MsgBox "Please Select Your Site.", _
vbExclamation, _
"Site Select"
End If
End Sub
Then I have this code:
Private Sub UserForm_Initialize()
If SavedSite.Text > "" Then
SelectSite.Hide
SelectOption.Show
Else
End If
End Sub
Am i doing this the long way round? I'm using Word 2003
I wonder if anyone can help me.
I'm trying to get a form in word vb.
The idea is you select an option from a dropdown, you press enter, it saves the document and remembers what you entered so next time you don't have to do it again. So next time you are sent to a different form and bypass the dropdown.
This is what I have so far, but it doesn't remember it, when I open a second time its forgot.
This is the button at the end of the form:
Private Sub CommandButton1_Click()
' check that a site is selected
If ComboBox1.Value > "" Then
' if yes then input and save
SavedSite.Value = ComboBox1.Value
SavedSite.Text = ComboBox1.Value
ActiveDocument.Save
' then go to next form
SelectSite.Hide
SelectOption.Show
Else
' if no then ask them to select
MsgBox "Please Select Your Site.", _
vbExclamation, _
"Site Select"
End If
End Sub
Then I have this code:
Private Sub UserForm_Initialize()
If SavedSite.Text > "" Then
SelectSite.Hide
SelectOption.Show
Else
End If
End Sub
Am i doing this the long way round? I'm using Word 2003