Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
buscher75 buscher75 is offline
external usenet poster
 
Posts: 2
Default User keys in serial number range, labels auto-fill

I would like create a user friendly word document that promts the user to
enter in the serial number range ex: RED0001 - RED1001 and have the labels
automatically fill in as many sheets as needed. I am converting these
numbers into a barcode.
I do not know a lot about this so details would be wonderful. Any ideas on
how to do this would be greatly appreciated. Thank You.
  #2   Report Post  
Posted to microsoft.public.word.tables
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default User keys in serial number range, labels auto-fill

Start with a document containing one page of empty labels (labels in Word
are just table cells with fixed dimensions) and then run a macro containing
the following code:

Dim i As Long, j As Long, n As Long, m As Long
Dim labeltext As String
Dim startnum As Long
Dim endnum As Long
Dim labels As Long
Dim newrow As Row
labeltext = InputBox("Enter the text for the label")
startnum = InputBox("Enter the starting number")
endnum = InputBox("Enter the last number")
labels = InputBox("Enter the number of labels in a row")
n = 0
With ActiveDocument.Tables(1)
For m = .Rows.Count To 2 Step -1
.Rows(m).Delete
Next m
For i = 1 To (endnum - startnum + 1) / labels
Set newrow = .Rows.Add
With newrow
For j = 1 To labels
.Cells(j).Range.Text = labeltext & Format(startnum + n,
"0000")
n = n + 1
Next j
End With
Next i
.Rows(1).Delete
End With

It will first ask for the text part of the label (RED), then the first
number to use 1 and the last number to use 1001 and the number of labels on
each row.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"buscher75" wrote in message
...
I would like create a user friendly word document that promts the user to
enter in the serial number range ex: RED0001 - RED1001 and have the labels
automatically fill in as many sheets as needed. I am converting these
numbers into a barcode.
I do not know a lot about this so details would be wonderful. Any ideas
on
how to do this would be greatly appreciated. Thank You.



  #3   Report Post  
Posted to microsoft.public.word.tables
buscher75 buscher75 is offline
external usenet poster
 
Posts: 2
Default User keys in serial number range, labels auto-fill

Thanks for the help Doug, it works! What I did not think about at the time
is the fact these serial numbers would be converted to barcode and therefor I
would need to automatically add an * to the front and back of the serial
number. Is there way I can add this to the code or do I need to prompt the
user to do this. Also, when you add * to the front and back of a word, the
word program automatically changes it to BOLD. I would need to shut this off
also. I hope you can help with this. I appreciate your time.

"Doug Robbins - Word MVP" wrote:

Start with a document containing one page of empty labels (labels in Word
are just table cells with fixed dimensions) and then run a macro containing
the following code:

Dim i As Long, j As Long, n As Long, m As Long
Dim labeltext As String
Dim startnum As Long
Dim endnum As Long
Dim labels As Long
Dim newrow As Row
labeltext = InputBox("Enter the text for the label")
startnum = InputBox("Enter the starting number")
endnum = InputBox("Enter the last number")
labels = InputBox("Enter the number of labels in a row")
n = 0
With ActiveDocument.Tables(1)
For m = .Rows.Count To 2 Step -1
.Rows(m).Delete
Next m
For i = 1 To (endnum - startnum + 1) / labels
Set newrow = .Rows.Add
With newrow
For j = 1 To labels
.Cells(j).Range.Text = labeltext & Format(startnum + n,
"0000")
n = n + 1
Next j
End With
Next i
.Rows(1).Delete
End With

It will first ask for the text part of the label (RED), then the first
number to use 1 and the last number to use 1001 and the number of labels on
each row.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"buscher75" wrote in message
...
I would like create a user friendly word document that promts the user to
enter in the serial number range ex: RED0001 - RED1001 and have the labels
automatically fill in as many sheets as needed. I am converting these
numbers into a barcode.
I do not know a lot about this so details would be wonderful. Any ideas
on
how to do this would be greatly appreciated. Thank You.




  #4   Report Post  
Posted to microsoft.public.word.tables
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default User keys in serial number range, labels auto-fill

A simple change to the

.Cells(j).Range.Text = "*" & labeltext & Format(startnum + n, "0000") & "*"

command will do that. Nothing turns to bold here so I am not sure what is
going on there.


Dim i As Long, j As Long, n As Long, m As Long
Dim labeltext As String
Dim startnum As Long
Dim endnum As Long
Dim labels As Long
Dim newrow As Row
labeltext = InputBox("Enter the text for the label")
startnum = InputBox("Enter the starting number")
endnum = InputBox("Enter the last number")
labels = InputBox("Enter the number of labels in a row")
n = 0
With ActiveDocument.Tables(1)
For m = .Rows.Count To 2 Step -1
.Rows(m).Delete
Next m
For i = 1 To (endnum - startnum + 1) / labels
Set newrow = .Rows.Add
With newrow
For j = 1 To labels
.Cells(j).Range.Text = "*" & labeltext & Format(startnum +
n, "0000") & "*"
n = n + 1
Next j
End With
Next i
.Rows(1).Delete
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"buscher75" wrote in message
news
Thanks for the help Doug, it works! What I did not think about at the
time
is the fact these serial numbers would be converted to barcode and
therefor I
would need to automatically add an * to the front and back of the serial
number. Is there way I can add this to the code or do I need to prompt
the
user to do this. Also, when you add * to the front and back of a word,
the
word program automatically changes it to BOLD. I would need to shut this
off
also. I hope you can help with this. I appreciate your time.

"Doug Robbins - Word MVP" wrote:

Start with a document containing one page of empty labels (labels in Word
are just table cells with fixed dimensions) and then run a macro
containing
the following code:

Dim i As Long, j As Long, n As Long, m As Long
Dim labeltext As String
Dim startnum As Long
Dim endnum As Long
Dim labels As Long
Dim newrow As Row
labeltext = InputBox("Enter the text for the label")
startnum = InputBox("Enter the starting number")
endnum = InputBox("Enter the last number")
labels = InputBox("Enter the number of labels in a row")
n = 0
With ActiveDocument.Tables(1)
For m = .Rows.Count To 2 Step -1
.Rows(m).Delete
Next m
For i = 1 To (endnum - startnum + 1) / labels
Set newrow = .Rows.Add
With newrow
For j = 1 To labels
.Cells(j).Range.Text = labeltext & Format(startnum + n,
"0000")
n = n + 1
Next j
End With
Next i
.Rows(1).Delete
End With

It will first ask for the text part of the label (RED), then the first
number to use 1 and the last number to use 1001 and the number of labels
on
each row.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"buscher75" wrote in message
...
I would like create a user friendly word document that promts the user
to
enter in the serial number range ex: RED0001 - RED1001 and have the
labels
automatically fill in as many sheets as needed. I am converting these
numbers into a barcode.
I do not know a lot about this so details would be wonderful. Any
ideas
on
how to do this would be greatly appreciated. Thank You.






  #5   Report Post  
Posted to microsoft.public.word.tables
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default User keys in serial number range, labels auto-fill

I suspect it's the AutoFormat As You Type setting of "*Bold* and _italic_
with real formatting". Uncheck that option and test again.

If that's the right item, add code to the macro to save the current value of
Options.AutoFormatAsYouTypeReplacePlainTextEmphasi s and set that option to
False at the beginning of the code; restore the original value at the end of
the code.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Doug Robbins - Word MVP wrote:
A simple change to the

.Cells(j).Range.Text = "*" & labeltext & Format(startnum + n, "0000")
& "*"
command will do that. Nothing turns to bold here so I am not sure
what is going on there.


Dim i As Long, j As Long, n As Long, m As Long
Dim labeltext As String
Dim startnum As Long
Dim endnum As Long
Dim labels As Long
Dim newrow As Row
labeltext = InputBox("Enter the text for the label")
startnum = InputBox("Enter the starting number")
endnum = InputBox("Enter the last number")
labels = InputBox("Enter the number of labels in a row")
n = 0
With ActiveDocument.Tables(1)
For m = .Rows.Count To 2 Step -1
.Rows(m).Delete
Next m
For i = 1 To (endnum - startnum + 1) / labels
Set newrow = .Rows.Add
With newrow
For j = 1 To labels
.Cells(j).Range.Text = "*" & labeltext &
Format(startnum + n, "0000") & "*"
n = n + 1
Next j
End With
Next i
.Rows(1).Delete
End With



"buscher75" wrote in message
news
Thanks for the help Doug, it works! What I did not think about at
the time
is the fact these serial numbers would be converted to barcode and
therefor I
would need to automatically add an * to the front and back of the
serial number. Is there way I can add this to the code or do I need
to prompt the
user to do this. Also, when you add * to the front and back of a
word, the
word program automatically changes it to BOLD. I would need to shut
this off
also. I hope you can help with this. I appreciate your time.

"Doug Robbins - Word MVP" wrote:

Start with a document containing one page of empty labels (labels
in Word are just table cells with fixed dimensions) and then run a
macro containing
the following code:

Dim i As Long, j As Long, n As Long, m As Long
Dim labeltext As String
Dim startnum As Long
Dim endnum As Long
Dim labels As Long
Dim newrow As Row
labeltext = InputBox("Enter the text for the label")
startnum = InputBox("Enter the starting number")
endnum = InputBox("Enter the last number")
labels = InputBox("Enter the number of labels in a row")
n = 0
With ActiveDocument.Tables(1)
For m = .Rows.Count To 2 Step -1
.Rows(m).Delete
Next m
For i = 1 To (endnum - startnum + 1) / labels
Set newrow = .Rows.Add
With newrow
For j = 1 To labels
.Cells(j).Range.Text = labeltext & Format(startnum
+ n, "0000")
n = n + 1
Next j
End With
Next i
.Rows(1).Delete
End With

It will first ask for the text part of the label (RED), then the
first number to use 1 and the last number to use 1001 and the
number of labels on
each row.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of
my services on a paid consulting basis.

Doug Robbins - Word MVP

"buscher75" wrote in message
...
I would like create a user friendly word document that promts the
user to
enter in the serial number range ex: RED0001 - RED1001 and have the
labels
automatically fill in as many sheets as needed. I am converting
these numbers into a barcode.
I do not know a lot about this so details would be wonderful. Any
ideas
on
how to do this would be greatly appreciated. Thank You.



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 do I insert a sequencing serial number, document number, prop Wayne Microsoft Word Help 1 May 1st 08 03:55 AM
Serial Number Derek Da Silva Microsoft Word Help 1 October 4th 07 08:10 PM
Serial Number rd Microsoft Word Help 3 June 6th 06 07:41 PM
how do I add a serial number field to a document? DaveM Microsoft Word Help 1 March 28th 06 02:52 AM
Auto fill of user info doesn't happen Dbltap Microsoft Word Help 1 September 28th 05 10:20 PM


All times are GMT +1. The time now is 05:04 PM.

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"