ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing help (https://www.excelbanter.com/excel-programming/407258-printing-help.html)

Office_Novice

Printing help
 
I have a userform named RPTFRM w/ a text box named rptDte and a Commad
button named cb1 this is what i have so far...

Private Sub cb1_Click()
Selection.AutoFilter Field:=5, Criteria1:=rptDte.Value
VBAProject.ThisWorkbook.PrintPreview
Selection.AutoFilter
Unload Me
End Sub

Private Sub UserForm_Initialize()
Range("Headers").Select
Selection.AutoFilter
End Sub

When i step through the code it does what i want but locks up after print
preview.
I am trying to get only the information printed defined in the criteria text
box. any help would be great.

JLGWhiz

Printing help
 
Couldn't duplicate the problem. Just curious about why you have the second
AutoFilter command just what looks like unloading the user form.

"Office_Novice" wrote:

I have a userform named RPTFRM w/ a text box named rptDte and a Commad
button named cb1 this is what i have so far...

Private Sub cb1_Click()
Selection.AutoFilter Field:=5, Criteria1:=rptDte.Value
VBAProject.ThisWorkbook.PrintPreview
Selection.AutoFilter
Unload Me
End Sub

Private Sub UserForm_Initialize()
Range("Headers").Select
Selection.AutoFilter
End Sub

When i step through the code it does what i want but locks up after print
preview.
I am trying to get only the information printed defined in the criteria text
box. any help would be great.


Office_Novice

Printing help
 
The second AutoFilter is to Undo the filter. I only need to create a report.
Thanks for looking though. it really worked for you, huh?

"JLGWhiz" wrote:

Couldn't duplicate the problem. Just curious about why you have the second
AutoFilter command just what looks like unloading the user form.

"Office_Novice" wrote:

I have a userform named RPTFRM w/ a text box named rptDte and a Commad
button named cb1 this is what i have so far...

Private Sub cb1_Click()
Selection.AutoFilter Field:=5, Criteria1:=rptDte.Value
VBAProject.ThisWorkbook.PrintPreview
Selection.AutoFilter
Unload Me
End Sub

Private Sub UserForm_Initialize()
Range("Headers").Select
Selection.AutoFilter
End Sub

When i step through the code it does what i want but locks up after print
preview.
I am trying to get only the information printed defined in the criteria text
box. any help would be great.


JLGWhiz

Printing help
 
Yes, it stepped through the print preview to the AutoFilter toggle command.
I would have used AutoFilterMode = False to turn it off, but that's just me.
I substituted a cell value for the textbox value, but it shouldn't make any
difference as long as you have a value in the textbox for it to capture, it
should filter on it. You might want to slip a message box in there or do a
debug.print to check that text box value. Here is an example of how to check
it.

Private Sub cb1_Click()
MsgBox rpt.Dte.Value
Selection.AutoFilter Field:=5, Criteria1:=rptDte.Value

The message box will show what the actual text box value is, if any, before
the filter is activated.


"Office_Novice" wrote:

The second AutoFilter is to Undo the filter. I only need to create a report.
Thanks for looking though. it really worked for you, huh?

"JLGWhiz" wrote:

Couldn't duplicate the problem. Just curious about why you have the second
AutoFilter command just what looks like unloading the user form.

"Office_Novice" wrote:

I have a userform named RPTFRM w/ a text box named rptDte and a Commad
button named cb1 this is what i have so far...

Private Sub cb1_Click()
Selection.AutoFilter Field:=5, Criteria1:=rptDte.Value
VBAProject.ThisWorkbook.PrintPreview
Selection.AutoFilter
Unload Me
End Sub

Private Sub UserForm_Initialize()
Range("Headers").Select
Selection.AutoFilter
End Sub

When i step through the code it does what i want but locks up after print
preview.
I am trying to get only the information printed defined in the criteria text
box. any help would be great.


Office_Novice

Printing help
 
I will give it a shot and let you know.

"JLGWhiz" wrote:

Yes, it stepped through the print preview to the AutoFilter toggle command.
I would have used AutoFilterMode = False to turn it off, but that's just me.
I substituted a cell value for the textbox value, but it shouldn't make any
difference as long as you have a value in the textbox for it to capture, it
should filter on it. You might want to slip a message box in there or do a
debug.print to check that text box value. Here is an example of how to check
it.

Private Sub cb1_Click()
MsgBox rpt.Dte.Value
Selection.AutoFilter Field:=5, Criteria1:=rptDte.Value

The message box will show what the actual text box value is, if any, before
the filter is activated.


"Office_Novice" wrote:

The second AutoFilter is to Undo the filter. I only need to create a report.
Thanks for looking though. it really worked for you, huh?

"JLGWhiz" wrote:

Couldn't duplicate the problem. Just curious about why you have the second
AutoFilter command just what looks like unloading the user form.

"Office_Novice" wrote:

I have a userform named RPTFRM w/ a text box named rptDte and a Commad
button named cb1 this is what i have so far...

Private Sub cb1_Click()
Selection.AutoFilter Field:=5, Criteria1:=rptDte.Value
VBAProject.ThisWorkbook.PrintPreview
Selection.AutoFilter
Unload Me
End Sub

Private Sub UserForm_Initialize()
Range("Headers").Select
Selection.AutoFilter
End Sub

When i step through the code it does what i want but locks up after print
preview.
I am trying to get only the information printed defined in the criteria text
box. any help would be great.



All times are GMT +1. The time now is 08:00 AM.

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