Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word 2000, Avery Labels, how to use macro in conjuction?

Status
Not open for further replies.

Ovatvvon

Programmer
Joined
Feb 1, 2001
Messages
1,514
Location
US
Hello,
I'm trying to create an auto work document that will let company users click on a button after they open up the word document and have them input a serial number and another code and a have a macro put in the company logo, the serial number and the code all formatted how it needs to be on all of the labels (Avery 8667). The real problem I'm running into is that the logo needs to actually be in our companies font which messes up the other text in the serial code, etc. So I need the logo in the company font and the rest in Times New Roman. I've been trying to select the text individually when printing them to the labels and formatting the font, but I am doing something wrong with the code.

It seems to be having problems with the lines of code that read: "With tbl.Cell(intRow, intColumn).Range.Characters(Start:=1, Length:=2).font". Can anyone tell me what I'm doing wrong and what I need to do to fix it?


-------------------------

Sub label()
Dim intRow, intColumn As Integer
Dim strLogo, strPartNumber, strDateCode As String
Dim tbl As Table
Set tbl = ActiveDocument.Tables(1)

For intRow = 1 To 3
For intColumn = 1 To 7 Step 2
strLogo = "LV"
strPartNumber = " 10-044-2754-6"
strDateCode = " 31L99"


tbl.Cell(intRow, intColumn).Range.Text = strLogo _
& strPartNumber _
& vbCrLf _
& strDateCode

With tbl.Cell(intRow, intColumn).Range.Characters(Start:=1, Length:=2).font
.Name = "Monotype Corsiva"
.Size = "10"
.Color = wdColorRed
End With


With tbl.Cell(intRow, intColumn).Range.Characters(Start:=3, Length:=20).font
.Name = "Times New Roman"
.Size = 10
.StrikeThrough = False
.Superscript = False
.Subscript = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

Next intColumn
Next intRow

End Sub -Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top