Hi Folks,

I have a a series of people that are in a listbox. For each person in the
listbox I want to create a new document based on a template, which can be
referred to - see below and see what I mean;

If CheckBox2.Value = True Then
For w = 0 To a ' Counts number of people
Documents.Add Template:="C:\Documents and Settings\User\Application
Data\Microsoft\Templates\Labels.dot"
Set LabelsDoc(w) = ActiveDocument
End If

Set LabelsDoc(w)=ActiveDocument is the line that I wont work of course. How
would one go about having LabelsDoc1, LabelsDoc2, LabelsDoc3 etc......

Cheers

-Al

Re: Numbered new documents... by Al

Al
Mon Oct 13 05:17:25 CDT 2003

PS: Anyone know how to count the total number of selected items in a list
box without looping through the lot?

Something like:

ListBox1.Selected.Count ?

TIA

-Al

"Al & Cay Grant" <bigal_nz@no$spam.remove.hotmail.com> wrote in message
news:bmdtg2$i7k$1@lust.ihug.co.nz...
> Hi Folks,
>
> I have a a series of people that are in a listbox. For each person in the
> listbox I want to create a new document based on a template, which can be
> referred to - see below and see what I mean;
>
> If CheckBox2.Value = True Then
> For w = 0 To a ' Counts number of people
> Documents.Add Template:="C:\Documents and Settings\User\Application
> Data\Microsoft\Templates\Labels.dot"
> Set LabelsDoc(w) = ActiveDocument
> End If
>
> Set LabelsDoc(w)=ActiveDocument is the line that I wont work of course.
How
> would one go about having LabelsDoc1, LabelsDoc2, LabelsDoc3 etc......
>
> Cheers
>
> -Al
>
>
>



Re: Numbered new documents... by Doug

Doug
Mon Oct 13 21:46:58 CDT 2003

Hi Al,

I am not sure why you would be creating a different document object for each
person. I believe that it would be more normal to dim a variable to hold
the document then use

Dim LabelsDoc as Document
For w = 0 to a 'Note a must be variable holding a numeric value
Set LabelsDoc = Documents.Add(Template: = etc
'do whatever else you want to do with LabelsDoc
LabelsDoc.SaveAs "drive:\path\filename" 'Include the counter in the
filename if that's what you want.
LabelsDoc.Close
Set LabelsDoc=Nothing
Next w

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
"Al & Cay Grant" <bigal_nz@no$spam.remove.hotmail.com> wrote in message
news:bmdtg2$i7k$1@lust.ihug.co.nz...
> Hi Folks,
>
> I have a a series of people that are in a listbox. For each person in the
> listbox I want to create a new document based on a template, which can be
> referred to - see below and see what I mean;
>
> If CheckBox2.Value = True Then
> For w = 0 To a ' Counts number of people
> Documents.Add Template:="C:\Documents and Settings\User\Application
> Data\Microsoft\Templates\Labels.dot"
> Set LabelsDoc(w) = ActiveDocument
> End If
>
> Set LabelsDoc(w)=ActiveDocument is the line that I wont work of course.
How
> would one go about having LabelsDoc1, LabelsDoc2, LabelsDoc3 etc......
>
> Cheers
>
> -Al
>
>
>