Microsoft Office Tutorials and References
In Depth Information
Creating Word Labels from an Excel Recipient List
Call UpdateProgressBar("Creating Empty Labels", _¶
3 * sngUnitWidth)¶
'Calculating the actual number of labels in a single page¶
'This is accomplished by comparing column widths and row¶
'heights. If there are differences of widths or heights¶
'then it means there is a distance between two labels¶
With objDoc.Tables(1)¶
intCols = .Columns.Count¶
For i = 1 To intCols¶
If .Columns(i).Width < sngMaxDim Then¶
sngMinDim = .Columns(i).Width¶
Else¶
sngMaxDim = .Columns(i).Width¶
End If¶
Next i¶
If sngMaxDim = sngMinDim Or intCols = 1 _¶
Or sngMinDim = 0 Then¶
'If column widths are same or there is only one column¶
'then there are actual number of columns for labels¶
totCols = intCols¶
Else¶
'There is distance between two labels¶
totCols = (intCols + 1) / 2¶
End If¶
'Same comparison using Rows¶
sngMinDim = 0: sngMaxDim = 0¶
intRows = .Rows.Count¶
For i = 1 To intRows¶
If .Rows(i).Height < sngMaxDim Then¶
sngMinDim = .Rows(i).Height¶
Else¶
sngMaxDim = .Rows(i).Height¶
End If¶
Next i¶
If sngMaxDim = sngMinDim Or intRows = 1 _¶
Or sngMinDim = 0 Then¶
totRows = intRows¶
Else¶
totRows = (intRows + 1) / 2¶
End If¶
End With¶
'Total necessary page count determined by total label count¶
lngPage = lngQTY / (totCols * totRows)¶
'Round the page count if necessary¶
If Int(lngPage) < lngPage Then¶
lngPage = Int(lngPage) + 1¶
Else¶
lngPage = Int(lngPage)¶
End If¶
Cmb
Search JabSto ::




Custom Search