Fontsize in Mailinglabels

  • Thread starter Keuken Waelwick Stichting De Hostert
  • Start date
K

Keuken Waelwick Stichting De Hostert

I have written a subroutine that prints certain text and a date on labels.
This works fine. But the text on the label is always in the standard
fontsize.
I want the date to be printed in fontsize 20, but I do not know how.

In the following code the variable 'Counter' represents the date.

Private Sub PrintButton_Click()
Counter = varBegindat
Do While Counter <= varEinddat
Etiket = "Best before" & vbCr & vbCr _
& Counter
Application.MailingLabel.PrintOut Name:="Agipa 119015",
Address:=Etiket
Counter = Counter + 1
Loop
End Sub

How can I change the fontsize to 20?
 
C

Cindy M -WordMVP-

Hi Keuken,

Using the coding technique you show, there is no way for you to affect the
font formatting on the label. You'd need to create the labels as a Word
document so that you have access to the actual ranges, then print that.

I'm not familiar with the labels you're using (Agipa 119015) so it's
difficult for me to give you any exact steps, but perhaps start by going
into the user interface, Tools/Envelopes and Labels and create a sheet of
labels ("New Document") with just the "Best before" and Enter-Enter.

Word should create a page with a table, each cell representing one label.
Save this as a template so that you can use it to create your labels. Now
type in a bit of placeholder text where the date should come, select that,
format it, and assign a bookmark name to it (Insert/Bookmark).

Your code can put the date into the bookmark(s), print a sheet, and repeat
for as often as necessary.
Dim rng as Word.Range

If ActiveDocument.Bookmarks.Exists("LabelDate") Then
Set rng = ActiveDocument.Bookmarks("LabelDate").Range
rng.Text = CStr(Counter)
ActiveDocument.Bookmarks.Add _
Name:="LabelDate", Range:=rng
End If
I have written a subroutine that prints certain text and a date on labels.
This works fine. But the text on the label is always in the standard
fontsize.
I want the date to be printed in fontsize 20, but I do not know how.

In the following code the variable 'Counter' represents the date.

Private Sub PrintButton_Click()
Counter = varBegindat
Do While Counter <= varEinddat
Etiket = "Best before" & vbCr & vbCr _
& Counter
Application.MailingLabel.PrintOut Name:="Agipa 119015",
Address:=Etiket
Counter = Counter + 1
Loop
End Sub

How can I change the fontsize to 20?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
O

Oculus Dei

Cindy,

thank you very much for your reply.
the macro you gave me, works, if there's only one named bookmark
but an a4-sheet consists of 3 rows of 8 labels, making a total of 24 labels.
i can not use the same name for all the bookmarks.
what's the easiest way to solve this?

Mark
 
C

Cindy M -WordMVP-

Hi Oculus,
the macro you gave me, works, if there's only one named bookmark
but an a4-sheet consists of 3 rows of 8 labels, making a total of 24 labels.
i can not use the same name for all the bookmarks.
OK, now we know more than we did :) I couldn't be sure, given the approach
you'd chosen (print one label at a time) whether these weren't one-label/sheet
labels.

There are a number of variations on the basic approach:
- you could use 24 bookmarks with incremented names (Lbl1, Lbl2, Lbl3, etc).
Refer to the bookmark *number* (ActiveDocument.Bookmarks(i)) and save the
incrementation in a document variable. Roughly:
ActiveDocument.Variables("labelcounter").Value = 1
Set rng =
ActiveDocument.Bookmarks(ActiveDocument.Variables("labelcounter").Value).Range
'etc. as in my first post; keeping it short
ActiveDocument.Variables("labelcounter").Value = _
ActiveDocument.Variables("labelcounter").Value + 1

- Another possibility, since all labels will be set up the same, would be to
just set the range at the end of the cell. Roughly (where i is again an
incremented counter):
Set rng = ActiveDocument.Tables(1).Range.Cell(i).Range
rng.MoveEnd wdCharacter, -1
rng.Collapse wdCollapseEnd
rng.Text = "syz"
rng.Font.Bold = True

- You could also put some placeholder text after "Best Before" and use Word's
Find/Replace functionality to insert and format the date.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top