View Single Post
 
Old 08-09-2022, 12:10 PM
littlepeaks littlepeaks is offline Windows 10 Office 2010 32bit
Novice
 
Join Date: Jan 2012
Location: Colorado Springs, CO
Posts: 16
littlepeaks is on a distinguished road
Default

Thanks --

I tried that, but got a runtime error 91 on the line

celAdd.Range.FormattedText = rngCell

It says: cel.Add.Range.FormattedText: = <Object variable or Width block variable not set>

rngCell did pick up the text from the first cell, so I'm not sure what's going on.

Anyway, my question was solved, and I am using a simpler macro to do what I want it to do. I will probably use an input box, or form for input in addition to my code, after I decide exactly what I want to do. My basic code to populate all the labels:

Sub Copy_Labels()
Dim strLabelText As String
Dim a As Long 'Row
Dim b As Long 'Column

Application.ScreenUpdating = False
strLabelText = ActiveDocument.Tables(1).Cell(1, 1).Range.Text
For b = 1 To 7 Step 2
For a = 1 To 20
ActiveDocument.Tables(1).Cell(a, b).Range.Text = strLabelText
Next a
Next b
Application.ScreenUpdating = True

End Sub

I found out that in columns, there is a column of blank cells between each column of Avery Labels.
Also turned off screen updating, because the macro was going kind of slow.

Thank-you everyone for your input.
Reply With Quote