Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
dgold82 dgold82 is offline
external usenet poster
 
Posts: 22
Default Print only certain pages in Form

Is there a way to make a checkbox that when checked clicking print would only
print those pages? I have a document with 50 forms in it and would like to
put a little box in the corner so that if it is checked word will only print
those pages.

Any ideas?
  #2   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print only certain pages in Form

If you put a check box on each page (not in the header) and name those check
boxes P1 to P50 then the following macro will print those pages on which the
check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True Then
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages,
Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking print
would only print those pages? I have a document with 50 forms in it
and would like to put a little box in the corner so that if it is
checked word will only print those pages.

Any ideas?



  #3   Report Post  
Posted to microsoft.public.word.newusers
dgold82 dgold82 is offline
external usenet poster
 
Posts: 22
Default Print only certain pages in Form

Thanks Graham! You have been a big help to me on a number of recent questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and name those check
boxes P1 to P50 then the following macro will print those pages on which the
check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True Then
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages,
Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking print
would only print those pages? I have a document with 50 forms in it
and would like to put a little box in the corner so that if it is
checked word will only print those pages.

Any ideas?




  #4   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print only certain pages in Form

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Thanks Graham! You have been a big help to me on a number of recent
questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and name
those check boxes P1 to P50 then the following macro will print
those pages on which the check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut Range:=wdPrintRangeOfPages,
Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking print
would only print those pages? I have a document with 50 forms in it
and would like to put a little box in the corner so that if it is
checked word will only print those pages.

Any ideas?



  #5   Report Post  
Posted to microsoft.public.word.newusers
dgold82 dgold82 is offline
external usenet poster
 
Posts: 22
Default Print only certain pages in Form

Hi Graham,

I think I spoke a little too soon. Can you please provide a little more
instructions with this one. I'm not sure I'm putting in the code correctly or
if I'm putting it in the right place. I also assume you are talking about the
active X checkbox? Thx

"Graham Mayor" wrote:

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Thanks Graham! You have been a big help to me on a number of recent
questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and name
those check boxes P1 to P50 then the following macro will print
those pages on which the check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut Range:=wdPrintRangeOfPages,
Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking print
would only print those pages? I have a document with 50 forms in it
and would like to put a little box in the corner so that if it is
checked word will only print those pages.

Any ideas?






  #6   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print only certain pages in Form

No I am talking about form field checkboxes and the macro is stored in the
form template and run on exit from each of the check box fields which should
be named P1 to P50 (or whatever the last number is). I would avoid the use
of activeX fields in protected forms. They create more problems than they
solve.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Hi Graham,

I think I spoke a little too soon. Can you please provide a little
more instructions with this one. I'm not sure I'm putting in the code
correctly or if I'm putting it in the right place. I also assume you
are talking about the active X checkbox? Thx

"Graham Mayor" wrote:

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Thanks Graham! You have been a big help to me on a number of recent
questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and name
those check boxes P1 to P50 then the following macro will print
those pages on which the check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking print
would only print those pages? I have a document with 50 forms in
it and would like to put a little box in the corner so that if it
is checked word will only print those pages.

Any ideas?



  #7   Report Post  
Posted to microsoft.public.word.newusers
dgold82 dgold82 is offline
external usenet poster
 
Posts: 22
Default Print only certain pages in Form

OK, so I am testing this on a 2 page form and this is what I put in as a
macro and named one checkbox "P1" (as the bookmark) and the other as P2. The
P1 checkbox is on the first page and the P2 checkbox is on the second. It
didn't work. I then tried removing the "Sub PrintOnly()" "End Sub" and that
didn't work. What am I doing wrong? The other macro codes you gave me are
working great.

Sub PrintOnly()

For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True Then
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages,
Pages:=format(i), Copies:=1
End If
Next i


End Sub

"Graham Mayor" wrote:

No I am talking about form field checkboxes and the macro is stored in the
form template and run on exit from each of the check box fields which should
be named P1 to P50 (or whatever the last number is). I would avoid the use
of activeX fields in protected forms. They create more problems than they
solve.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Hi Graham,

I think I spoke a little too soon. Can you please provide a little
more instructions with this one. I'm not sure I'm putting in the code
correctly or if I'm putting it in the right place. I also assume you
are talking about the active X checkbox? Thx

"Graham Mayor" wrote:

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Thanks Graham! You have been a big help to me on a number of recent
questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and name
those check boxes P1 to P50 then the following macro will print
those pages on which the check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking print
would only print those pages? I have a document with 50 forms in
it and would like to put a little box in the corner so that if it
is checked word will only print those pages.

Any ideas?




  #8   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print only certain pages in Form

There is a premature wrap in the line beginning 'Then' which could be your
problem. Correct that or use

Sub PrintOnly()
For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True Then
ActiveDocument.PrintOut _
Range:=wdPrintRangeOfPages, _
Pages:=format(i), _
Copies:=1
End If
Next i
End Sub

instead

I take it you locked the form?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
OK, so I am testing this on a 2 page form and this is what I put in
as a macro and named one checkbox "P1" (as the bookmark) and the
other as P2. The P1 checkbox is on the first page and the P2 checkbox
is on the second. It didn't work. I then tried removing the "Sub
PrintOnly()" "End Sub" and that didn't work. What am I doing wrong?
The other macro codes you gave me are working great.

Sub PrintOnly()

For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut Range:=wdPrintRangeOfPages,
Pages:=format(i), Copies:=1
End If
Next i


End Sub

"Graham Mayor" wrote:

No I am talking about form field checkboxes and the macro is stored
in the form template and run on exit from each of the check box
fields which should be named P1 to P50 (or whatever the last number
is). I would avoid the use of activeX fields in protected forms.
They create more problems than they solve.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Hi Graham,

I think I spoke a little too soon. Can you please provide a little
more instructions with this one. I'm not sure I'm putting in the
code correctly or if I'm putting it in the right place. I also
assume you are talking about the active X checkbox? Thx

"Graham Mayor" wrote:

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Thanks Graham! You have been a big help to me on a number of
recent questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and name
those check boxes P1 to P50 then the following macro will print
those pages on which the check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value =
True Then ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking
print would only print those pages? I have a document with 50
forms in it and would like to put a little box in the corner so
that if it is checked word will only print those pages.

Any ideas?



  #9   Report Post  
Posted to microsoft.public.word.newusers
dgold82 dgold82 is offline
external usenet poster
 
Posts: 22
Default Print only certain pages in Form

I got this one to work. The only problem is that is automatically begins
printing the page when I leave the checkbox field (it calculates on exit). I
was thinking that I would just check all the boxes on the pages that I want
and then at the end clicking print and it would only print those pages.

So basically this document is going to have 50 forms in it. For each given
record we would only need about 5-10 of them. We would leave those 5-10 forms
checked from your macro below and then whenever we want to print them we
would just click print and it would print those 5-10 forms whenever we needed
them. The macro you gave basically acts like a "print this page" type of
button. Does that makes sense. I really appreciate your help with this but I
also don't want to take too much more of your time if I am not being clear.

Thank again!

"Graham Mayor" wrote:

There is a premature wrap in the line beginning 'Then' which could be your
problem. Correct that or use

Sub PrintOnly()
For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True Then
ActiveDocument.PrintOut _
Range:=wdPrintRangeOfPages, _
Pages:=format(i), _
Copies:=1
End If
Next i
End Sub

instead

I take it you locked the form?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
OK, so I am testing this on a 2 page form and this is what I put in
as a macro and named one checkbox "P1" (as the bookmark) and the
other as P2. The P1 checkbox is on the first page and the P2 checkbox
is on the second. It didn't work. I then tried removing the "Sub
PrintOnly()" "End Sub" and that didn't work. What am I doing wrong?
The other macro codes you gave me are working great.

Sub PrintOnly()

For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut Range:=wdPrintRangeOfPages,
Pages:=format(i), Copies:=1
End If
Next i


End Sub

"Graham Mayor" wrote:

No I am talking about form field checkboxes and the macro is stored
in the form template and run on exit from each of the check box
fields which should be named P1 to P50 (or whatever the last number
is). I would avoid the use of activeX fields in protected forms.
They create more problems than they solve.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Hi Graham,

I think I spoke a little too soon. Can you please provide a little
more instructions with this one. I'm not sure I'm putting in the
code correctly or if I'm putting it in the right place. I also
assume you are talking about the active X checkbox? Thx

"Graham Mayor" wrote:

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Thanks Graham! You have been a big help to me on a number of
recent questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and name
those check boxes P1 to P50 then the following macro will print
those pages on which the check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value =
True Then ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking
print would only print those pages? I have a document with 50
forms in it and would like to put a little box in the corner so
that if it is checked word will only print those pages.

Any ideas?




  #10   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print only certain pages in Form

It sounds like you are running the macro on exit from the check box field.
Run it from a custom toolbar button.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
I got this one to work. The only problem is that is automatically
begins printing the page when I leave the checkbox field (it
calculates on exit). I was thinking that I would just check all the
boxes on the pages that I want and then at the end clicking print and
it would only print those pages.

So basically this document is going to have 50 forms in it. For each
given record we would only need about 5-10 of them. We would leave
those 5-10 forms checked from your macro below and then whenever we
want to print them we would just click print and it would print those
5-10 forms whenever we needed them. The macro you gave basically acts
like a "print this page" type of button. Does that makes sense. I
really appreciate your help with this but I also don't want to take
too much more of your time if I am not being clear.

Thank again!

"Graham Mayor" wrote:

There is a premature wrap in the line beginning 'Then' which could
be your problem. Correct that or use

Sub PrintOnly()
For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True Then
ActiveDocument.PrintOut _
Range:=wdPrintRangeOfPages, _
Pages:=format(i), _
Copies:=1
End If
Next i
End Sub

instead

I take it you locked the form?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
OK, so I am testing this on a 2 page form and this is what I put in
as a macro and named one checkbox "P1" (as the bookmark) and the
other as P2. The P1 checkbox is on the first page and the P2
checkbox is on the second. It didn't work. I then tried removing
the "Sub PrintOnly()" "End Sub" and that didn't work. What am I
doing wrong? The other macro codes you gave me are working great.

Sub PrintOnly()

For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut Range:=wdPrintRangeOfPages,
Pages:=format(i), Copies:=1
End If
Next i


End Sub

"Graham Mayor" wrote:

No I am talking about form field checkboxes and the macro is stored
in the form template and run on exit from each of the check box
fields which should be named P1 to P50 (or whatever the last number
is). I would avoid the use of activeX fields in protected forms.
They create more problems than they solve.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Hi Graham,

I think I spoke a little too soon. Can you please provide a little
more instructions with this one. I'm not sure I'm putting in the
code correctly or if I'm putting it in the right place. I also
assume you are talking about the active X checkbox? Thx

"Graham Mayor" wrote:

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Thanks Graham! You have been a big help to me on a number of
recent questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and
name those check boxes P1 to P50 then the following macro will
print those pages on which the check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value =
True Then ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking
print would only print those pages? I have a document with 50
forms in it and would like to put a little box in the corner
so that if it is checked word will only print those pages.

Any ideas?





  #11   Report Post  
Posted to microsoft.public.word.newusers
Terry Farrell Terry Farrell is offline
external usenet poster
 
Posts: 2,904
Default Print only certain pages in Form

This really sounds like an over-the-top complex solution. Why not have a
single template comprising a a front page displaying a list of available
forms (with a brief description of each if required) and a check box at the
side of each. The user then clicks a check box which fires a macro to add
the form as a new section to the current document. This will simplify the
document and make it much smaller as it will only contain 5 to 10 forms
instead of 50 plus forms and a few macros. It will be easier to handle and
search too and if the forms get updated, only the linked form will need
updating.

--
Terry Farrell - MSWord MVP

"dgold82" wrote in message
...
I got this one to work. The only problem is that is automatically begins
printing the page when I leave the checkbox field (it calculates on exit).
I
was thinking that I would just check all the boxes on the pages that I
want
and then at the end clicking print and it would only print those pages.

So basically this document is going to have 50 forms in it. For each given
record we would only need about 5-10 of them. We would leave those 5-10
forms
checked from your macro below and then whenever we want to print them we
would just click print and it would print those 5-10 forms whenever we
needed
them. The macro you gave basically acts like a "print this page" type of
button. Does that makes sense. I really appreciate your help with this but
I
also don't want to take too much more of your time if I am not being
clear.

Thank again!

"Graham Mayor" wrote:

There is a premature wrap in the line beginning 'Then' which could be
your
problem. Correct that or use

Sub PrintOnly()
For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True Then
ActiveDocument.PrintOut _
Range:=wdPrintRangeOfPages, _
Pages:=format(i), _
Copies:=1
End If
Next i
End Sub

instead

I take it you locked the form?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
OK, so I am testing this on a 2 page form and this is what I put in
as a macro and named one checkbox "P1" (as the bookmark) and the
other as P2. The P1 checkbox is on the first page and the P2 checkbox
is on the second. It didn't work. I then tried removing the "Sub
PrintOnly()" "End Sub" and that didn't work. What am I doing wrong?
The other macro codes you gave me are working great.

Sub PrintOnly()

For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut Range:=wdPrintRangeOfPages,
Pages:=format(i), Copies:=1
End If
Next i


End Sub

"Graham Mayor" wrote:

No I am talking about form field checkboxes and the macro is stored
in the form template and run on exit from each of the check box
fields which should be named P1 to P50 (or whatever the last number
is). I would avoid the use of activeX fields in protected forms.
They create more problems than they solve.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Hi Graham,

I think I spoke a little too soon. Can you please provide a little
more instructions with this one. I'm not sure I'm putting in the
code correctly or if I'm putting it in the right place. I also
assume you are talking about the active X checkbox? Thx

"Graham Mayor" wrote:

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Thanks Graham! You have been a big help to me on a number of
recent questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and name
those check boxes P1 to P50 then the following macro will print
those pages on which the check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value =
True Then ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking
print would only print those pages? I have a document with 50
forms in it and would like to put a little box in the corner so
that if it is checked word will only print those pages.

Any ideas?





  #12   Report Post  
Posted to microsoft.public.word.newusers
dgold82 dgold82 is offline
external usenet poster
 
Posts: 22
Default Print only certain pages in Form

Hi Terry! That was my thinking at first until I couldn't find a macro code to
do that. I asked how on this message board (in "new users" on 12/8/08) and
was told it was too complex. If you can provide me with some code and
instruction I would be very grateful. Either way--a big thank you to Graham
and to you!

"Terry Farrell" wrote:

This really sounds like an over-the-top complex solution. Why not have a
single template comprising a a front page displaying a list of available
forms (with a brief description of each if required) and a check box at the
side of each. The user then clicks a check box which fires a macro to add
the form as a new section to the current document. This will simplify the
document and make it much smaller as it will only contain 5 to 10 forms
instead of 50 plus forms and a few macros. It will be easier to handle and
search too and if the forms get updated, only the linked form will need
updating.

--
Terry Farrell - MSWord MVP

"dgold82" wrote in message
...
I got this one to work. The only problem is that is automatically begins
printing the page when I leave the checkbox field (it calculates on exit).
I
was thinking that I would just check all the boxes on the pages that I
want
and then at the end clicking print and it would only print those pages.

So basically this document is going to have 50 forms in it. For each given
record we would only need about 5-10 of them. We would leave those 5-10
forms
checked from your macro below and then whenever we want to print them we
would just click print and it would print those 5-10 forms whenever we
needed
them. The macro you gave basically acts like a "print this page" type of
button. Does that makes sense. I really appreciate your help with this but
I
also don't want to take too much more of your time if I am not being
clear.

Thank again!

"Graham Mayor" wrote:

There is a premature wrap in the line beginning 'Then' which could be
your
problem. Correct that or use

Sub PrintOnly()
For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True Then
ActiveDocument.PrintOut _
Range:=wdPrintRangeOfPages, _
Pages:=format(i), _
Copies:=1
End If
Next i
End Sub

instead

I take it you locked the form?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
OK, so I am testing this on a 2 page form and this is what I put in
as a macro and named one checkbox "P1" (as the bookmark) and the
other as P2. The P1 checkbox is on the first page and the P2 checkbox
is on the second. It didn't work. I then tried removing the "Sub
PrintOnly()" "End Sub" and that didn't work. What am I doing wrong?
The other macro codes you gave me are working great.

Sub PrintOnly()

For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut Range:=wdPrintRangeOfPages,
Pages:=format(i), Copies:=1
End If
Next i


End Sub

"Graham Mayor" wrote:

No I am talking about form field checkboxes and the macro is stored
in the form template and run on exit from each of the check box
fields which should be named P1 to P50 (or whatever the last number
is). I would avoid the use of activeX fields in protected forms.
They create more problems than they solve.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Hi Graham,

I think I spoke a little too soon. Can you please provide a little
more instructions with this one. I'm not sure I'm putting in the
code correctly or if I'm putting it in the right place. I also
assume you are talking about the active X checkbox? Thx

"Graham Mayor" wrote:

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Thanks Graham! You have been a big help to me on a number of
recent questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and name
those check boxes P1 to P50 then the following macro will print
those pages on which the check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value =
True Then ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking
print would only print those pages? I have a document with 50
forms in it and would like to put a little box in the corner so
that if it is checked word will only print those pages.

Any ideas?





  #13   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print only certain pages in Form

There are examples on my web site http://www.gmayor.com/SelectFile.htm and
http://www.gmayor.com/word_vba_examples.htm which might help point the way.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Hi Terry! That was my thinking at first until I couldn't find a macro
code to do that. I asked how on this message board (in "new users" on
12/8/08) and was told it was too complex. If you can provide me with
some code and instruction I would be very grateful. Either way--a big
thank you to Graham and to you!

"Terry Farrell" wrote:

This really sounds like an over-the-top complex solution. Why not
have a single template comprising a a front page displaying a list
of available forms (with a brief description of each if required)
and a check box at the side of each. The user then clicks a check
box which fires a macro to add the form as a new section to the
current document. This will simplify the document and make it much
smaller as it will only contain 5 to 10 forms instead of 50 plus
forms and a few macros. It will be easier to handle and search too
and if the forms get updated, only the linked form will need
updating.

--
Terry Farrell - MSWord MVP

"dgold82" wrote in message
...
I got this one to work. The only problem is that is automatically
begins printing the page when I leave the checkbox field (it
calculates on exit). I
was thinking that I would just check all the boxes on the pages
that I want
and then at the end clicking print and it would only print those
pages.

So basically this document is going to have 50 forms in it. For
each given record we would only need about 5-10 of them. We would
leave those 5-10 forms
checked from your macro below and then whenever we want to print
them we would just click print and it would print those 5-10 forms
whenever we needed
them. The macro you gave basically acts like a "print this page"
type of button. Does that makes sense. I really appreciate your
help with this but I
also don't want to take too much more of your time if I am not being
clear.

Thank again!

"Graham Mayor" wrote:

There is a premature wrap in the line beginning 'Then' which could
be your
problem. Correct that or use

Sub PrintOnly()
For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut _
Range:=wdPrintRangeOfPages, _
Pages:=format(i), _
Copies:=1
End If
Next i
End Sub

instead

I take it you locked the form?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
OK, so I am testing this on a 2 page form and this is what I put
in as a macro and named one checkbox "P1" (as the bookmark) and
the other as P2. The P1 checkbox is on the first page and the P2
checkbox is on the second. It didn't work. I then tried removing
the "Sub PrintOnly()" "End Sub" and that didn't work. What am I
doing wrong? The other macro codes you gave me are working great.

Sub PrintOnly()

For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, Pages:=format(i), Copies:=1
End If
Next i


End Sub

"Graham Mayor" wrote:

No I am talking about form field checkboxes and the macro is
stored in the form template and run on exit from each of the
check box fields which should be named P1 to P50 (or whatever
the last number is). I would avoid the use of activeX fields in
protected forms. They create more problems than they solve.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Hi Graham,

I think I spoke a little too soon. Can you please provide a
little more instructions with this one. I'm not sure I'm
putting in the code correctly or if I'm putting it in the right
place. I also assume you are talking about the active X
checkbox? Thx

"Graham Mayor" wrote:

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Thanks Graham! You have been a big help to me on a number of
recent questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and
name those check boxes P1 to P50 then the following macro
will print those pages on which the check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value
= True Then ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking
print would only print those pages? I have a document with
50 forms in it and would like to put a little box in the
corner so that if it is checked word will only print those
pages.

Any ideas?



  #14   Report Post  
Posted to microsoft.public.word.newusers
Terry Farrell Terry Farrell is offline
external usenet poster
 
Posts: 2,904
Default Print only certain pages in Form

....and if Graham's examples still leave you short of your requirement, post
a question ion the appropriate Word.VBA newsgroup where the developers hang
out.

Terry

"dgold82" wrote in message
...
Hi Terry! That was my thinking at first until I couldn't find a macro code
to
do that. I asked how on this message board (in "new users" on 12/8/08) and
was told it was too complex. If you can provide me with some code and
instruction I would be very grateful. Either way--a big thank you to
Graham
and to you!

"Terry Farrell" wrote:

This really sounds like an over-the-top complex solution. Why not have a
single template comprising a a front page displaying a list of available
forms (with a brief description of each if required) and a check box at
the
side of each. The user then clicks a check box which fires a macro to add
the form as a new section to the current document. This will simplify the
document and make it much smaller as it will only contain 5 to 10 forms
instead of 50 plus forms and a few macros. It will be easier to handle
and
search too and if the forms get updated, only the linked form will need
updating.

--
Terry Farrell - MSWord MVP

"dgold82" wrote in message
...
I got this one to work. The only problem is that is automatically begins
printing the page when I leave the checkbox field (it calculates on
exit).
I
was thinking that I would just check all the boxes on the pages that I
want
and then at the end clicking print and it would only print those pages.

So basically this document is going to have 50 forms in it. For each
given
record we would only need about 5-10 of them. We would leave those 5-10
forms
checked from your macro below and then whenever we want to print them
we
would just click print and it would print those 5-10 forms whenever we
needed
them. The macro you gave basically acts like a "print this page" type
of
button. Does that makes sense. I really appreciate your help with this
but
I
also don't want to take too much more of your time if I am not being
clear.

Thank again!

"Graham Mayor" wrote:

There is a premature wrap in the line beginning 'Then' which could be
your
problem. Correct that or use

Sub PrintOnly()
For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True Then
ActiveDocument.PrintOut _
Range:=wdPrintRangeOfPages, _
Pages:=format(i), _
Copies:=1
End If
Next i
End Sub

instead

I take it you locked the form?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
OK, so I am testing this on a 2 page form and this is what I put in
as a macro and named one checkbox "P1" (as the bookmark) and the
other as P2. The P1 checkbox is on the first page and the P2
checkbox
is on the second. It didn't work. I then tried removing the "Sub
PrintOnly()" "End Sub" and that didn't work. What am I doing wrong?
The other macro codes you gave me are working great.

Sub PrintOnly()

For i = 1 To 2
If ActiveDocument.FormFields("P" & i).CheckBox.Value = True
Then ActiveDocument.PrintOut Range:=wdPrintRangeOfPages,
Pages:=format(i), Copies:=1
End If
Next i


End Sub

"Graham Mayor" wrote:

No I am talking about form field checkboxes and the macro is stored
in the form template and run on exit from each of the check box
fields which should be named P1 to P50 (or whatever the last number
is). I would avoid the use of activeX fields in protected forms.
They create more problems than they solve.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Hi Graham,

I think I spoke a little too soon. Can you please provide a little
more instructions with this one. I'm not sure I'm putting in the
code correctly or if I'm putting it in the right place. I also
assume you are talking about the active X checkbox? Thx

"Graham Mayor" wrote:

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Thanks Graham! You have been a big help to me on a number of
recent questions.

"Graham Mayor" wrote:

If you put a check box on each page (not in the header) and
name
those check boxes P1 to P50 then the following macro will print
those pages on which the check box is checked.

For i = 1 To 50
If ActiveDocument.FormFields("P" & i).CheckBox.Value =
True Then ActiveDocument.PrintOut
Range:=wdPrintRangeOfPages, Pages:=format(i), Copies:=1
End If
Next i

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dgold82 wrote:
Is there a way to make a checkbox that when checked clicking
print would only print those pages? I have a document with 50
forms in it and would like to put a little box in the corner
so
that if it is checked word will only print those pages.

Any ideas?






Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to print pages 1 and 4 on one page and pages 2 and 3 on the ba mdinning Page Layout 1 November 10th 07 03:05 PM
In Word, Can I combine pages, I want 3 pages to print on 1 ? Chris Microsoft Word Help 0 October 15th 07 04:43 PM
capture data from a form and print it in the header of all the pages divya Tables 8 July 7th 06 04:11 PM
how do i print multiple pages without a line separating pages in W donna98 Microsoft Word Help 1 May 28th 05 05:25 AM
How do I Print four 8 1/2 x 11 pages on two 11 x 17 pages in Word Clubeagle Page Layout 0 May 17th 05 06:16 PM


All times are GMT +1. The time now is 01:11 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"