Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default userform printing

I have a userform that I am piecing together and I would like to include a
checkbox control that would print a receipt using the info in the userform.
The receipt would be another excel worksheet inside the same workbook. I
think that I can use the checkbox to start a macro that will take the data
from the user form into my receipt template, but I don't know the code to
print from there. My current userform data looks like this:

Private Sub Submit_Click()

Dim res As VbMsgBoxResult

If Custname.Text = "" Then
MsgBox "Please enter a valid name!", vbOKOnly
End If

If CCNo.Text = "" Then
res = MsgBox(Prompt:="Do you want to enter a CC for the customer?", _
Buttons:=vbYesNo + vbQuestion)

If res = vbYes Then user.Custinfo.Show
End If


custnm = Custname.Text
custpn = Custno.Value
dtoa = TOA.Value
CCN = CCNo.Value
ds = DOS.Value
EX = Exp.Value
rt = rate.Value
rm = remarks.Value


com = "Customer: " & custnm & Chr(10) & "Phone #: " & custpn & Chr(10) &
"TOA: " & dtoa & _
Chr(10) & "Nights staying: " & ds & Chr(10) & "Rate: " & rt
& Chr(10) & "CC#: " & CCN & _
Chr(10) & "EXP Date: " & EX & Chr(10) & "Remarks: " & rm

ActiveCell.Range("A1").Select
ActiveCell.FormulaR1C1 = custnm

ActiveCell.AddComment com

ActiveCell.Comment.Shape.Height = 120
ActiveCell.Comment.Shape.Width = 160

Custinfo.Hide

Unload Me

End Sub


Any help would be appreciated! Thanks!
--
EW - Analyst
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default userform printing

Something like

Worksheets("Receipt").Printout

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ewagz" wrote in message
...
I have a userform that I am piecing together and I would like to include a
checkbox control that would print a receipt using the info in the

userform.
The receipt would be another excel worksheet inside the same workbook. I
think that I can use the checkbox to start a macro that will take the data
from the user form into my receipt template, but I don't know the code to
print from there. My current userform data looks like this:

Private Sub Submit_Click()

Dim res As VbMsgBoxResult

If Custname.Text = "" Then
MsgBox "Please enter a valid name!", vbOKOnly
End If

If CCNo.Text = "" Then
res = MsgBox(Prompt:="Do you want to enter a CC for the customer?", _
Buttons:=vbYesNo + vbQuestion)

If res = vbYes Then user.Custinfo.Show
End If


custnm = Custname.Text
custpn = Custno.Value
dtoa = TOA.Value
CCN = CCNo.Value
ds = DOS.Value
EX = Exp.Value
rt = rate.Value
rm = remarks.Value


com = "Customer: " & custnm & Chr(10) & "Phone #: " & custpn & Chr(10) &
"TOA: " & dtoa & _
Chr(10) & "Nights staying: " & ds & Chr(10) & "Rate: " &

rt
& Chr(10) & "CC#: " & CCN & _
Chr(10) & "EXP Date: " & EX & Chr(10) & "Remarks: " & rm

ActiveCell.Range("A1").Select
ActiveCell.FormulaR1C1 = custnm

ActiveCell.AddComment com

ActiveCell.Comment.Shape.Height = 120
ActiveCell.Comment.Shape.Width = 160

Custinfo.Hide

Unload Me

End Sub


Any help would be appreciated! Thanks!
--
EW - Analyst



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default userform printing

How do I make the check box trigger another macro?
--
EW - Analyst


"Bob Phillips" wrote:

Something like

Worksheets("Receipt").Printout

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ewagz" wrote in message
...
I have a userform that I am piecing together and I would like to include a
checkbox control that would print a receipt using the info in the

userform.
The receipt would be another excel worksheet inside the same workbook. I
think that I can use the checkbox to start a macro that will take the data
from the user form into my receipt template, but I don't know the code to
print from there. My current userform data looks like this:

Private Sub Submit_Click()

Dim res As VbMsgBoxResult

If Custname.Text = "" Then
MsgBox "Please enter a valid name!", vbOKOnly
End If

If CCNo.Text = "" Then
res = MsgBox(Prompt:="Do you want to enter a CC for the customer?", _
Buttons:=vbYesNo + vbQuestion)

If res = vbYes Then user.Custinfo.Show
End If


custnm = Custname.Text
custpn = Custno.Value
dtoa = TOA.Value
CCN = CCNo.Value
ds = DOS.Value
EX = Exp.Value
rt = rate.Value
rm = remarks.Value


com = "Customer: " & custnm & Chr(10) & "Phone #: " & custpn & Chr(10) &
"TOA: " & dtoa & _
Chr(10) & "Nights staying: " & ds & Chr(10) & "Rate: " &

rt
& Chr(10) & "CC#: " & CCN & _
Chr(10) & "EXP Date: " & EX & Chr(10) & "Remarks: " & rm

ActiveCell.Range("A1").Select
ActiveCell.FormulaR1C1 = custnm

ActiveCell.AddComment com

ActiveCell.Comment.Shape.Height = 120
ActiveCell.Comment.Shape.Width = 160

Custinfo.Hide

Unload Me

End Sub


Any help would be appreciated! Thanks!
--
EW - Analyst




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default userform printing

Use the Checkbox click event procedure and test its value within there. I
would have thought a commandbutton was more appropriate though, because if
you use a checkbox, they would need to en check it before they could check
it again, for a subsequent print.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ewagz" wrote in message
...
How do I make the check box trigger another macro?
--
EW - Analyst


"Bob Phillips" wrote:

Something like

Worksheets("Receipt").Printout

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ewagz" wrote in message
...
I have a userform that I am piecing together and I would like to

include a
checkbox control that would print a receipt using the info in the

userform.
The receipt would be another excel worksheet inside the same workbook.

I
think that I can use the checkbox to start a macro that will take the

data
from the user form into my receipt template, but I don't know the code

to
print from there. My current userform data looks like this:

Private Sub Submit_Click()

Dim res As VbMsgBoxResult

If Custname.Text = "" Then
MsgBox "Please enter a valid name!", vbOKOnly
End If

If CCNo.Text = "" Then
res = MsgBox(Prompt:="Do you want to enter a CC for the customer?",

_
Buttons:=vbYesNo + vbQuestion)

If res = vbYes Then user.Custinfo.Show
End If


custnm = Custname.Text
custpn = Custno.Value
dtoa = TOA.Value
CCN = CCNo.Value
ds = DOS.Value
EX = Exp.Value
rt = rate.Value
rm = remarks.Value


com = "Customer: " & custnm & Chr(10) & "Phone #: " & custpn & Chr(10)

&
"TOA: " & dtoa & _
Chr(10) & "Nights staying: " & ds & Chr(10) & "Rate: "

&
rt
& Chr(10) & "CC#: " & CCN & _
Chr(10) & "EXP Date: " & EX & Chr(10) & "Remarks: " &

rm

ActiveCell.Range("A1").Select
ActiveCell.FormulaR1C1 = custnm

ActiveCell.AddComment com

ActiveCell.Comment.Shape.Height = 120
ActiveCell.Comment.Shape.Width = 160

Custinfo.Hide

Unload Me

End Sub


Any help would be appreciated! Thanks!
--
EW - Analyst






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Printing sparx Excel Discussion (Misc queries) 8 July 31st 06 08:59 AM
Printing a Userform Brad Excel Programming 2 June 28th 06 03:19 PM
Userform - Printing Greg B Excel Worksheet Functions 9 September 16th 05 12:11 AM
userform printing Access Excel Programming 0 June 10th 05 04:48 AM
Userform - Printing Greg B Excel Discussion (Misc queries) 8 March 13th 05 02:40 PM


All times are GMT +1. The time now is 11:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"