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
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