PDA

View Full Version : Labels, Word and Checkbox Help Needed



chrishon
04-20-2006, 09:16 AM
I am using Avery Labels in a Word template. I have a form with several checkboxes and a position selector and number of labels selector. Everything is fine if I choose one checkbox, but I want users to be able to choose multiple checkboxes. For example, I can choose to start the labels with the first label, and need 3 labels of each. If I choose three checkboxes, it would be a total of 9 labels. I can't figure out how to write the first checkbox labels, find the next empty label, add the next three labels, etc. I use If statements to choose the single labels. Any help would be greatful.

geekgirlau
04-21-2006, 04:36 AM
Hi chrishon,

Welcome to the board! Can you what you have so far?

chrishon
04-21-2006, 05:40 AM
This code allows me to go to any position on the label sheet, pick one of the checkboxes and pick the amount of labels I need. Here is the short version of what I have:

Sub CmdOK_Click()
'This is the same for all 30 labels with the BookMark Name changed
If cmbPosition.Value = 1 Then
Selection.GoTo What:=wdGoToBookmark, Name:="Label1"
Call CheckLabels
Selection.TypeText FileName
Call CopySubFile
End If

'This tells what should go on the label if this is checked. The other checkboxes are the same with Filename = " "

Private Sub CheckLabels()
If chkCorrespondence = True Then
FileName = "CORRESPONDENCE"
End If

'This says if no. of labes is more than 1, copy the label
Private Sub CopySubFile()
If CmbNoLabels.Value >= 2 Then

For i = 2 To CmbNoLabels.Value
Call CopyLabel
Next i
End If
End Sub

'Macro to copy the cell
Sub CopyLabel()
Selection.SelectCell
Selection.Copy
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.Paste
End Sub

If there is a better way of doing this, that would also be appreciated.