Ask in a programming newsgroup such as microsoft.public.word.vba.general for
assistance with this. But see also the following article, which might be
helpful:
http://word.mvps.org/faqs/macrosvba/...piesOf1Doc.htm.
--
Stefan Blom
Microsoft Word MVP
"tweacle" wrote:
>
> I have the following macro that im using with a set up to automatically
> increase no's by 1 everytime they print.
>
> Sub PrintAndNumber()
> Dim prty As DocumentProperty
> Dim bFound As Boolean
> Const strPropertyName = "Ref Number"
>
> For Each prty In ActiveDocument.CustomDocumentProperties
> If UCase$(prty.Name) = UCase$(strPropertyName) Then
> bFound = True
> Exit For
> End If
> Next prty
> If Not bFound Then
> Set prty =
> ActiveDocument.CustomDocumentProperties.Add(strPropertyName, False,
> msoPropertyTypeNumber, 1)
> End If
> Do
> ActiveDocument.Fields.Update
> ActiveDocument.PrintOut
> ActiveDocument.CustomDocumentProperties(strPropertyName).Value
> = ActiveDocument.CustomDocumentProperties(strPropertyName).Value + 1
> Loop Until
> ActiveDocument.CustomDocumentProperties(strPropertyName).Value 5
> End Sub
>
> The problem im having is when I first run it its fine. When I save and
> close workbook and then run macro again after reopening it dont
> completely run it just prints the next no and then stops. Can anyone
> help on amending the macro above so that once its completed it saves
> and closes document and then when I reopen the document at a later time
> it just carries on printing all the sheets increasing the ref no's when
> I run the macro. Thanks
>
>
>
>
> --
> tweacle
>