Print / Number Generator in Word 2002

25/09/2003 - 09:36 por Ravi Sandhu | Informe spam
HI all


I have something that seems a bit of a conundrum

I have never used the visual basic element of word, and only macros on a
basic level. So please start from scratch for me.

This is what I need to do:

When I open this particular file in Word, I need it to have 100 copies ready
to print.

Each of those 100 copies needs to have a unique reference number.

To make things difficult, I need to make sure that each time 100 different
reference numbers are printed off, they have never been used before.

So for example.

I need to open the file, which when I print it, will automatically print
100, to a chosen printer.

I need for each sheet to have a reference number. The first 100 might be
between 000001 - 000100

But then once printed and closed, I need for the next time I open the file,
the reference numbers: 000101 - 000200

Please help me with this

Thank you kindly

Preguntas similare

Leer las respuestas

#1 Cindy Meister -WordMVP-
25/09/2003 - 14:38 | Informe spam
A response to this duplicate question has been posted in
one of the word.vba groups.

Cindy Meister
Respuesta Responder a este mensaje
#2 Cindy Meister -WordMVP-
25/09/2003 - 14:38 | Informe spam
A response to this duplicate question has been posted in
one of the word.vba groups.

Cindy Meister
Respuesta Responder a este mensaje
#3 Nilda Beatriz Díaz
25/09/2003 - 15:46 | Informe spam
Ravi these are Spanish groups, however I will send to you a sample document.

Ravi estos son grupos en Español, pero trataré de enviarte un documento de ejemplo.

Suerte
Nilda Beatriz Díaz
MS - MVP
Desde el tercer planeta a partir del Sol
"Ravi Sandhu" escribió en el mensaje
news:tVwcb.40$
HI all


I have something that seems a bit of a conundrum

I have never used the visual basic element of word, and only macros on a
basic level. So please start from scratch for me.

This is what I need to do:

When I open this particular file in Word, I need it to have 100 copies ready
to print.

Each of those 100 copies needs to have a unique reference number.

To make things difficult, I need to make sure that each time 100 different
reference numbers are printed off, they have never been used before.

So for example.

I need to open the file, which when I print it, will automatically print
100, to a chosen printer.

I need for each sheet to have a reference number. The first 100 might be
between 000001 - 000100

But then once printed and closed, I need for the next time I open the file,
the reference numbers: 000101 - 000200

Please help me with this

Thank you kindly





Respuesta Responder a este mensaje
#4 Nilda Beatriz Díaz
25/09/2003 - 15:46 | Informe spam
Ravi these are Spanish groups, however I will send to you a sample document.

Ravi estos son grupos en Español, pero trataré de enviarte un documento de ejemplo.

Suerte
Nilda Beatriz Díaz
MS - MVP
Desde el tercer planeta a partir del Sol
"Ravi Sandhu" escribió en el mensaje
news:tVwcb.40$
HI all


I have something that seems a bit of a conundrum

I have never used the visual basic element of word, and only macros on a
basic level. So please start from scratch for me.

This is what I need to do:

When I open this particular file in Word, I need it to have 100 copies ready
to print.

Each of those 100 copies needs to have a unique reference number.

To make things difficult, I need to make sure that each time 100 different
reference numbers are printed off, they have never been used before.

So for example.

I need to open the file, which when I print it, will automatically print
100, to a chosen printer.

I need for each sheet to have a reference number. The first 100 might be
between 000001 - 000100

But then once printed and closed, I need for the next time I open the file,
the reference numbers: 000101 - 000200

Please help me with this

Thank you kindly





Respuesta Responder a este mensaje
#5 Nilda Beatriz Díaz
25/09/2003 - 16:11 | Informe spam
Bueno como ya le respondieron en otro de los grupos, por si a alguien le interesa.
Este código tiene que estar en el ThisDocument, en el Objeto Document, Procedimiento Open.


Private Sub Document_Open()
Dim Numerador As Integer
'para este ejemplo estamos guardando el archivo donde se
'guarda el último número en la unidad C:
Dim NombreArchivo As String
NombreArchivo = "C:/UltimoNumero.txt"
'Se fija si ya existe el archivo
If Dir(NombreArchivo) <> "" Then 'el archivo existe
Open NombreArchivo For Input As 1 'abre el archivo
Input #1, Numerador 'lee el número grabado en el archivo
Close 1 'cierra el archivo
End If
Dim Hasta As Integer 'variable para cantidad de copias
Hasta = InputBox("Cuantas copias?", , "100") 'pide la cantidad de copias
Dim cuenta As Integer 'variable para contar las copias impresas
For cuenta = 1 To Hasta 'repite la cantidad de veces pedida
Numerador = Numerador + 1 'le suma uno
ActiveDocument.FormFields("Numerar").Result = Numerador
'coloca en el campo del documento el número que corresponde
ActiveDocument.PrintOut False, , , , , , , 1
'imprime una copia
Next
Open NombreArchivo For Output As 1 'abre el archivo para grabar el nuevo número
Print #1, Numerador 'guarda el número en el archivo
Close 1 'lo cierra
End Sub


Suerte
Nilda Beatriz Díaz
MS - MVP
Desde el tercer planeta a partir del Sol
"Ravi Sandhu" escribió en el mensaje
news:tVwcb.40$
HI all


I have something that seems a bit of a conundrum

I have never used the visual basic element of word, and only macros on a
basic level. So please start from scratch for me.

This is what I need to do:

When I open this particular file in Word, I need it to have 100 copies ready
to print.

Each of those 100 copies needs to have a unique reference number.

To make things difficult, I need to make sure that each time 100 different
reference numbers are printed off, they have never been used before.

So for example.

I need to open the file, which when I print it, will automatically print
100, to a chosen printer.

I need for each sheet to have a reference number. The first 100 might be
between 000001 - 000100

But then once printed and closed, I need for the next time I open the file,
the reference numbers: 000101 - 000200

Please help me with this

Thank you kindly





email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida