Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-18-2014, 11:41 PM
macropod's Avatar
macropod macropod is offline Directory MailMerge with Category Grouped Lists on Labels Windows 7 32bit Directory MailMerge with Category Grouped Lists on Labels Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

FWIW, an alternative approach would be to forget about using Word and doing the lot from within Excel. For example, the following macro creates all your labels on Sheet 2 of your existing workbook:


Code:
Sub Demo()
Dim lRow As Long, lCol As Long
Dim i As Long, j As Long, k As Long, l As Long, m As Long
Dim WkShtSrc As Worksheet, WkShtTgt As Worksheet
k = 0
Set WkShtSrc = ThisWorkbook.Worksheets("Sheet1")
Set WkShtTgt = ThisWorkbook.Worksheets("Sheet2")
With WkShtTgt
  .UsedRange.ClearContents
  .Columns("B:D").ColumnWidth = 43.3
  .Columns("A").ColumnWidth = 10
  .Columns("C").ColumnWidth = 10
  .Rows.RowHeight = 240
  With .Columns("A:D").Font
    .Name = "Arial"
    .Size = 12
  End With
End With
With WkShtSrc
  lRow = .UsedRange.Cells.SpecialCells(xlCellTypeLastCell).Row
  lCol = .UsedRange.Cells.SpecialCells(xlCellTypeLastCell).Column
  For i = 2 To lRow
    If .Cells(i, 1).Value = .Cells(i - 1, 1).Value Then
      With WkShtTgt.Cells(m, l)
        .Value = .Text & Chr(10)
        For j = 2 To lCol
          .Value = .Text & Chr(10) & WkShtSrc.Cells(i, j)
        Next
      End With
    Else
      l = (k Mod 2 + 1) * 2: k = k + 1: m = -Int(-k / 2)
      With WkShtTgt.Cells(m, l)
        .Value = "BOX " & WkShtSrc.Cells(i, 1) & Chr(10)
        For j = 2 To lCol
          .Value = .Text & Chr(10) & WkShtSrc.Cells(i, j)
        Next
      End With
    End If
  Next
End With
End Sub
You will probably need to adjust the sheet margins and, perhaps, the values used for the columns A & C widths to get the exact alignment you require but, once that's done, there's no need to involve Word.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory MailMerge with Category Grouped Lists on Labels SQL MailMerge Labels Mark J Rees Mail Merge 2 05-10-2013 06:00 PM
Directory MailMerge with Category Grouped Lists on Labels Pictorial directory using mailmerge JohnFinNC Mail Merge 6 10-04-2012 06:36 PM
Directory MailMerge with Category Grouped Lists on Labels Directory Mailmerge rohitjain80 Mail Merge 1 02-12-2012 03:42 AM
Excel Multi Level Category labels Spay Excel 0 03-14-2011 01:05 PM
MailMerge Labels Question trims30 Mail Merge 0 08-04-2010 05:21 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:47 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft