Group:  Microsoft Word ยป microsoft.public.word.newusers
Thread: Print only certain pages in Form

Geek News

Print only certain pages in Form
dgold82 12/9/2008 3:25:01 PM
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?
Re: Print only certain pages in Form
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 12/10/2008 6:08:13 AM
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:
[Quoted Text]
> 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?


Re: Print only certain pages in Form
dgold82 12/10/2008 3:16:03 PM
Thanks Graham! You have been a big help to me on a number of recent questions.

"Graham Mayor" wrote:

[Quoted Text]
> 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?
>
>
>
Re: Print only certain pages in Form
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 12/10/2008 3:34:34 PM
You are welcome :)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

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


dgold82 wrote:
[Quoted Text]
> 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?


Re: Print only certain pages in Form
dgold82 12/12/2008 1:36:01 AM
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:

[Quoted Text]
> 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?
>
>
>
Re: Print only certain pages in Form
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 12/12/2008 7:25:36 AM
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:
[Quoted Text]
> 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?


Re: Print only certain pages in Form
dgold82 12/12/2008 5:33:08 PM
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:

[Quoted Text]
> 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?
>
>
>
Re: Print only certain pages in Form
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 12/13/2008 7:25:11 AM
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:
[Quoted Text]
> 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?


Re: Print only certain pages in Form
dgold82 12/14/2008 12:29:01 AM
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:

[Quoted Text]
> 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?
>
>
>
Re: Print only certain pages in Form
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 12/14/2008 7:48:08 AM
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:
[Quoted Text]
> 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?


Re: Print only certain pages in Form
"Terry Farrell" <terryfarrell[ at ]msn.com> 12/14/2008 11:15:01 AM
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" <dgold82[ at ]discussions.microsoft.com> wrote in message
news:BA0B1DC7-FD2D-4712-B147-2CBF1A6FC719[ at ]microsoft.com...
[Quoted Text]
>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?
>>
>>
>>

Re: Print only certain pages in Form
dgold82 12/15/2008 12:40:00 AM
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:

[Quoted Text]
> 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" <dgold82[ at ]discussions.microsoft.com> wrote in message
> news:BA0B1DC7-FD2D-4712-B147-2CBF1A6FC719[ at ]microsoft.com...
> >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?
> >>
> >>
> >>
>
>
Re: Print only certain pages in Form
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 12/15/2008 7:26:49 AM
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:
[Quoted Text]
> 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" <dgold82[ at ]discussions.microsoft.com> wrote in message
>> news:BA0B1DC7-FD2D-4712-B147-2CBF1A6FC719[ at ]microsoft.com...
>>> 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?


Re: Print only certain pages in Form
"Terry Farrell" <terryfarrell[ at ]msn.com> 12/15/2008 9:33:22 AM
....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" <dgold82[ at ]discussions.microsoft.com> wrote in message
news:31708AA8-4118-45BB-8894-15374662EF3A[ at ]microsoft.com...
[Quoted Text]
> 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" <dgold82[ at ]discussions.microsoft.com> wrote in message
>> news:BA0B1DC7-FD2D-4712-B147-2CBF1A6FC719[ at ]microsoft.com...
>> >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?
>> >>
>> >>
>> >>
>>
>>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net