ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Further simple Form questions (https://www.excelbanter.com/excel-programming/325235-further-simple-form-questions.html)

Stuart[_21_]

Further simple Form questions
 
1 form containing 1 frame. Within the frame are labels and textboxes, with
the idea that labels are fixed, and users simply enter their data in the
adjacent textboxes.

So far I have no code, but I will show the form via an addin's menu.

Q1: how do I return the user from the form (ie back to the addin)?
Q2: how does the user save the form?
Q3: how does the user print the form?

Any help would be much appreciated.

Regards.





Tom Ogilvy

Further simple Form questions
 
Private Sub CommandButton1_click()
Userform1.PrintForm
unload me
End Sub


write the data somewhere. You don't save the userform.

--
Regards,
Tom Ogilvy


"Stuart" wrote in message
...
1 form containing 1 frame. Within the frame are labels and textboxes, with
the idea that labels are fixed, and users simply enter their data in the
adjacent textboxes.

So far I have no code, but I will show the form via an addin's menu.

Q1: how do I return the user from the form (ie back to the addin)?
Q2: how does the user save the form?
Q3: how does the user print the form?

Any help would be much appreciated.

Regards.







Bob Phillips[_6_]

Further simple Form questions
 
If you mean that you want to preserve whatever was on the form when you say
save it, then you will have to save all of the textbox, combobox values etc
onto a worksheet in the addin, and next time the form is shown, then you
load the form from that worksheet data.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
1 form containing 1 frame. Within the frame are labels and textboxes, with
the idea that labels are fixed, and users simply enter their data in the
adjacent textboxes.

So far I have no code, but I will show the form via an addin's menu.

Q1: how do I return the user from the form (ie back to the addin)?
Q2: how does the user save the form?
Q3: how does the user print the form?

Any help would be much appreciated.

Regards.







Stuart[_21_]

Further simple Form questions
 
Many thanks for the reply.

So I have to place a 'Print' button on the Form for the
user to click? Will this show up in the print?

Regards.

"Tom Ogilvy" wrote in message
...
Private Sub CommandButton1_click()
Userform1.PrintForm
unload me
End Sub


write the data somewhere. You don't save the userform.

--
Regards,
Tom Ogilvy


"Stuart" wrote in message
...
1 form containing 1 frame. Within the frame are labels and textboxes,
with
the idea that labels are fixed, and users simply enter their data in the
adjacent textboxes.

So far I have no code, but I will show the form via an addin's menu.

Q1: how do I return the user from the form (ie back to the addin)?
Q2: how does the user save the form?
Q3: how does the user print the form?

Any help would be much appreciated.

Regards.









Stuart[_21_]

Further simple Form questions
 
Many thanks for the reply, but I don't understand how to achieve that.

Regards.

"Bob Phillips" wrote in message
...
If you mean that you want to preserve whatever was on the form when you
say
save it, then you will have to save all of the textbox, combobox values
etc
onto a worksheet in the addin, and next time the form is shown, then you
load the form from that worksheet data.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
1 form containing 1 frame. Within the frame are labels and textboxes,
with
the idea that labels are fixed, and users simply enter their data in the
adjacent textboxes.

So far I have no code, but I will show the form via an addin's menu.

Q1: how do I return the user from the form (ie back to the addin)?
Q2: how does the user save the form?
Q3: how does the user print the form?

Any help would be much appreciated.

Regards.









Bob Phillips[_6_]

Further simple Form questions
 
In the Userform_Terminate event add code like

With ThisWorkbook.Worksheets("SaveForm")
.Range("A1").Value = Me.Textbox1.Value
.Range("A2").Value = Me.ComboBox1.Value
'etc.
End With

You will have to adapt to all the controls that you wsih to save, I can't
possibly know all of that.

To reload, just do the opposite in the Userform_Initilaize event

With ThisWorkbook.Worksheets("SaveForm")
Me.Textbox1.Value = .Range("A1").Value
Me.ComboBox1.Value = .Range("A2").Value
'etc.
End With

One thing to be aware of is that loading the form in the initialize event
like this can trigger control event code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
Many thanks for the reply, but I don't understand how to achieve that.

Regards.

"Bob Phillips" wrote in message
...
If you mean that you want to preserve whatever was on the form when you
say
save it, then you will have to save all of the textbox, combobox values
etc
onto a worksheet in the addin, and next time the form is shown, then you
load the form from that worksheet data.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
1 form containing 1 frame. Within the frame are labels and textboxes,
with
the idea that labels are fixed, and users simply enter their data in

the
adjacent textboxes.

So far I have no code, but I will show the form via an addin's menu.

Q1: how do I return the user from the form (ie back to the addin)?
Q2: how does the user save the form?
Q3: how does the user print the form?

Any help would be much appreciated.

Regards.











Bob Phillips[_6_]

Further simple Form questions
 
Normally it would, but you could try

Private Sub Print_Click()
Me.Print.Visible = False
Userform1.PrintForm
unload me
End Sub

If you don't want to unload the form after printing, just change that to

Me.Print.Visible = True

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
Many thanks for the reply.

So I have to place a 'Print' button on the Form for the
user to click? Will this show up in the print?

Regards.

"Tom Ogilvy" wrote in message
...
Private Sub CommandButton1_click()
Userform1.PrintForm
unload me
End Sub


write the data somewhere. You don't save the userform.

--
Regards,
Tom Ogilvy


"Stuart" wrote in message
...
1 form containing 1 frame. Within the frame are labels and textboxes,
with
the idea that labels are fixed, and users simply enter their data in

the
adjacent textboxes.

So far I have no code, but I will show the form via an addin's menu.

Q1: how do I return the user from the form (ie back to the addin)?
Q2: how does the user save the form?
Q3: how does the user print the form?

Any help would be much appreciated.

Regards.











Stuart[_21_]

Further simple Form questions
 
Will give it a try.
Many thanks

Regards.

"Bob Phillips" wrote in message
...
Normally it would, but you could try

Private Sub Print_Click()
Me.Print.Visible = False
Userform1.PrintForm
unload me
End Sub

If you don't want to unload the form after printing, just change that to

Me.Print.Visible = True

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
Many thanks for the reply.

So I have to place a 'Print' button on the Form for the
user to click? Will this show up in the print?

Regards.

"Tom Ogilvy" wrote in message
...
Private Sub CommandButton1_click()
Userform1.PrintForm
unload me
End Sub


write the data somewhere. You don't save the userform.

--
Regards,
Tom Ogilvy


"Stuart" wrote in message
...
1 form containing 1 frame. Within the frame are labels and textboxes,
with
the idea that labels are fixed, and users simply enter their data in

the
adjacent textboxes.

So far I have no code, but I will show the form via an addin's menu.

Q1: how do I return the user from the form (ie back to the addin)?
Q2: how does the user save the form?
Q3: how does the user print the form?

Any help would be much appreciated.

Regards.













Stuart[_21_]

Further simple Form questions
 
Thanks for that.
Will post anew if need be.

Thanks to you both.

Regards.

"Bob Phillips" wrote in message
...
In the Userform_Terminate event add code like

With ThisWorkbook.Worksheets("SaveForm")
.Range("A1").Value = Me.Textbox1.Value
.Range("A2").Value = Me.ComboBox1.Value
'etc.
End With

You will have to adapt to all the controls that you wsih to save, I can't
possibly know all of that.

To reload, just do the opposite in the Userform_Initilaize event

With ThisWorkbook.Worksheets("SaveForm")
Me.Textbox1.Value = .Range("A1").Value
Me.ComboBox1.Value = .Range("A2").Value
'etc.
End With

One thing to be aware of is that loading the form in the initialize event
like this can trigger control event code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
Many thanks for the reply, but I don't understand how to achieve that.

Regards.

"Bob Phillips" wrote in message
...
If you mean that you want to preserve whatever was on the form when you
say
save it, then you will have to save all of the textbox, combobox values
etc
onto a worksheet in the addin, and next time the form is shown, then
you
load the form from that worksheet data.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
1 form containing 1 frame. Within the frame are labels and textboxes,
with
the idea that labels are fixed, and users simply enter their data in

the
adjacent textboxes.

So far I have no code, but I will show the form via an addin's menu.

Q1: how do I return the user from the form (ie back to the addin)?
Q2: how does the user save the form?
Q3: how does the user print the form?

Any help would be much appreciated.

Regards.














All times are GMT +1. The time now is 05:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com