none
how do Use 5 ComboBoxs as radio buttons RRS feed

  • Question

  • Hi all I am trying to get 5 comboboxs (1st 2 = cmbSatellite & cmbCable) to work as a radio button group. I am using cmb"boxname".ListIndex = -1 to reset previous selections.
    The first box works fine if you select a cmbCable vale then a cmbSatellite value  the form returns the satellite selected values. However if you select a satellite selection then a cable selection  the form retuns no value.

    I tryed adding .setfocus but then nothing worked.

    Does anybody know how to do this?

    Code follows:

    'Variables:
    'Scope, Name, Type, description/comment
    Private booSAT As Boolean 'Satellite selected variable
    Private booCAB As Boolean 'Cable selected variable
    Private booIP  As Boolean 'IPTV selected variable
    Private booSdDe_STB As Boolean 'Standard Definition STB variable
    Private booSdDe_DVR As Boolean 'Standard Definition DVR variable
    Private booHiDe_STB As Boolean 'High Definition STB variable
    Private booHiDe_DVR As Boolean 'High Definition DVR variable

    Private Sub cmbSatellite_Click()
    cmbCable.ListIndex = -1
    'cmbSatellite.SetFocus
    If cmbSatellite.ListIndex = 0 Then
    booSAT = True
    booSdDe_STB = True
    ElseIf cmbSatellite.ListIndex = 1 Then
    booSAT = True
    booSdDe_DVR = True
    ElseIf cmbSatellite.ListIndex = 2 Then
    booSAT = True
    booSdDe_DVR = True
    ElseIf cmbSatellite.ListIndex = 3 Then
    booSAT = True
    booHiDe_STB = True
    ElseIf cmbSatellite.ListIndex = 4 Then
    booSAT = True
    booHiDe_STB = True
    ElseIf cmbSatellite.ListIndex = 5 Then
    booSAT = True
    booHiDe_DVR = True
    Else:  MsgBox "selected option " + cmbSatellite.ListIndex + "no box selected"
    End If
    End Sub

    Private Sub cmbCable_Click()
    cmbSatellite.ListIndex = -1
    'cmbCable.SetFocus
    If cmbCable.ListIndex = 0 Then
    booCAB = True
    booSdDe_STB = True
    ElseIf cmbCable.ListIndex = 1 Then
    booCAB = True
    booSdDe_DVR = True
    ElseIf cmbSatellite.ListIndex = 2 Then
    booCAB = True
    booSdDe_DVR = True
    ElseIf cmbSatellite.ListIndex = 3 Then
    booCAB = True
    booHiDe_STB = True
    ElseIf cmbSatellite.ListIndex = 4 Then
    booCAB = True
    booHiDe_STB = True
    ElseIf cmbSatellite.ListIndex = 5 Then
    booCAB = True
    booHiDe_DVR = True
    Else:  MsgBox "selected cable option " '+ cmbSatellite.ListIndex + "no box selected"
    End If
    End Sub

     

    Private Sub UserForm_Initialize()
    ' cmdOK.SetFocus
    Me.Hide

    cmbSatellite.AddItem "SD STB"
    cmbSatellite.AddItem "SD DVR ready"
    cmbSatellite.AddItem "SD DVR"
    cmbSatellite.AddItem "HD STB"
    cmbSatellite.AddItem "HD DVR ready"
    cmbSatellite.AddItem "HD DVR"

    cmbCable.AddItem "SD STB"
    cmbCable.AddItem "SD DVR ready"
    cmbCable.AddItem "SD DVR"
    cmbCable.AddItem "HD STB"
    cmbCable.AddItem "HD DVR ready"
    cmbCable.AddItem "HD DVR"

    End Sub

     

    Tuesday, January 25, 2011 5:57 PM

Answers

  • Hi Doug, Thanks I see from Gerg's  artical I can get the effect I wanted  by using cascading boxes however i am still intrested in knowiing if it is possible to group boxes so they act as a groupe of radio buttons. Also I am intrested in knowng why the cmbSatellite box works like I want  and the cmbCable box only works if I remove the "cmbSatellite.ListIndex = -1"  line, when both boxes contain similar code?
    Wednesday, January 26, 2011 9:52 AM
  • Hi Doug thanks for your help, I managed to solve the problem by using private integer variables inside the _Click() subroutines in case anybody is  interested in how it did it I the full form code follows.

      (from a template the maco builds a document by adding a new or existing customer covering letter to the selected description)

    'Final Code:

    ' Variables:

    ' Scope, Name, Type, description/comment

    Private SATidx As Integer 'Satellite and type of box selected variable (0-5)

    Private CABidx As Integer 'Cable and type of box selected variable (0-5)

    Private IPTVidx As Integer 'IPTV and type of box selected variable (0-5)

    Private DDTidx As Integer 'DDT and type of box selected variable (0-5)

    Private OTHidx As Integer 'Other and type of service selected variable (0-3)

     

    Private Sub cmbSatellite_Click()

    cmbCable.ListIndex = -1

    CABidx = -1

    cmbIPTV.ListIndex = -1

    IPTVidx = -1

    cmbDDT.ListIndex = -1

    DDTidx = -1

    cmbOTH.ListIndex = -1

    OTHidx = -1

    SATidx = cmbSatellite.ListIndex

    End Sub

     

    Private Sub cmbCable_Click()

    cmbSatellite.ListIndex = -1

    SATidx = -1

    cmbIPTV.ListIndex = -1

    IPTVidx = -1

    cmbDDT.ListIndex = -1

    DDTidx = -1

    cmbOTH.ListIndex = -1

    OTHidx = -1

    CABidx = cmbCable.ListIndex

    End Sub

     

    Private Sub cmbIPTV_Click()

    cmbSatellite.ListIndex = -1

    SATidx = -1

    cmbCable.ListIndex = -1

    CABidx = -1

    cmbDDT.ListIndex = -1

    DDTidx = -1

    cmbOTH.ListIndex = -1

    OTHidx = -1

    IPTVidx = cmbIPTV.ListIndex

    End Sub

     

    Private Sub cmbDDT_Click()

    cmbSatellite.ListIndex = -1

    SATidx = -1

    cmbCable.ListIndex = -1

    CABidx = -1

    cmbIPTV.ListIndex = -1

    IPTVidx = -1

    cmbOTH.ListIndex = -1

    OTHidx = -1

    DDTidx = cmbDDT.ListIndex

    End Sub

     

    Private Sub cmbOTH_Click()

    cmbSatellite.ListIndex = -1

    SATidx = -1

    cmbCable.ListIndex = -1

    CABidx = -1

    cmbIPTV.ListIndex = -1

    IPTVidx = -1

    cmbDDT.ListIndex = -1

    DDTidx = -1

    OTHidx = cmbOTH.ListIndex

    End Sub

     

    Private Sub cmdOK_Click()

    Me.Hide

    ' Select satellite, cable, DDT, IPTV or service

    If SATidx >= 0 Then

     GoTo SatBoxes

     End If

    If CABidx >= 0 Then

    GoTo CabBoxes

    End If

    If IPTVidx >= 0 Then

    GoTo IPTVBoxes

    End If

    If DDTidx >= 0 Then

    GoTo DDTBoxes

    End If

    If OTHidx >= 0 Then

    GoTo Other

    End If

     

    SatBoxes:

    ' Select type of box

    If SATidx = 0 Then

     Selection.InsertFile FileName:="03_SAT_SD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf SATidx = 1 Then

       Selection.InsertFile FileName:="04_SAT_SD_DVR_Ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf SATidx = 2 Then

       Selection.InsertFile FileName:="05_ SAT_SD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf SATidx = 3 Then

       Selection.InsertFile FileName:="06_ SAT_HD_STB.docc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf SATidx = 4 Then

       Selection.InsertFile FileName:="07_SAT_HD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf SATidx = 5 Then

       Selection.InsertFile FileName:="08_SAT_HD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    Else: MsgBox "No satellite box selected please select type: SD STB, SD DVR, HD STB or HD DVR"

    End If

    GoTo TandC

     

    CabBoxes:

    If CABidx = 0 Then

    Selection.InsertFile FileName:="09_ CAB_SD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf CABidx = 1 Then

    Selection.InsertFile FileName:="10_CAB_ SD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf CABidx = 2 Then

    Selection.InsertFile FileName:="11_CAB_SD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf CABidx = 3 Then

    Selection.InsertFile FileName:="12_CAB_HD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf CABidx = 4 Then

    Selection.InsertFile FileName:="13_CAB_HD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf CABidx = 5 Then

    Selection.InsertFile FileName:="14_CAB_HD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    Else: MsgBox "No cable box selected please select type: SD STB, SD DVR, HD STB or HD DVR"

    End If

     GoTo TandC

     

    IPTVBoxes:

    If IPTVidx = 0 Then

    Selection.InsertFile FileName:="15_IPTV_SD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf IPTVidx = 1 Then

    Selection.InsertFile FileName:="16_IPTV_SD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf IPTVidx = 2 Then

    Selection.InsertFile FileName:="17_IPTV_SD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf IPTVidx = 3 Then

    Selection.InsertFile FileName:="18_IPTV_HD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf IPTVidx = 4 Then

    Selection.InsertFile FileName:="19_IPTV_HD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf IPTVidx = 5 Then

    Selection.InsertFile FileName:="20_IPTV_HD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    Else: MsgBox "No IPTV box selected please select type: SD STB, SD DVR, HD STB or HD DVR"

    End If

    GoTo TandC

     

    DDTBoxes:

    If DDTidx = 0 Then

     Selection.InsertFile FileName:="21_DDT_SD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf DDTidx = 1 Then

       Selection.InsertFile FileName:="22_DDT_SD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf DDTidx = 2 Then

       Selection.InsertFile FileName:="23_ DDT_SD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf DDTidx = 3 Then

       Selection.InsertFile FileName:="24_DDT_HD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf DDTidx = 4 Then

       Selection.InsertFile FileName:="25_DDT_HD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf DDTidx = 5 Then

       Selection.InsertFile FileName:="26_DDT_HD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    Else: MsgBox "No DDT box selected please select type: SD STB, SD DVR, HD STB or HD DVR"

    End If

    GoTo TandC

     

    Other:

    If OTHidx = 0 Then

     Selection.InsertFile FileName:="27_Other_Field_trial.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf OTHidx = 1 Then

       Selection.InsertFile FileName:="28_Other_service_1.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf OTHidx = 2 Then

       Selection.InsertFile FileName:="29_Other_service_2.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf OTHidx = 3 Then

       Selection.InsertFile FileName:="30_Other_Free_text.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    Else: MsgBox "No service selected please select type"

    End If

    GoTo TandC

     

    TandC: 'Autonew macro calls next userform

    Unload Me

    End Sub

     

    Private Sub UserForm_Initialize()

    cmdOK.SetFocus

    Me.Hide

    Selection.GoTo What:=wdGoToBookmark, Name:="Covering_Letter"

        Selection.Find.ClearFormatting

        With Selection.Find

            .Text = ""

            .Replacement.Text = ""

            .Forward = True

            .Wrap = wdFindContinue

            .Format = False

            .MatchCase = False

            .MatchWholeWord = False

            .MatchWildcards = False

            .MatchSoundsLike = False

            .MatchAllWordForms = False

        End With

       

        If MsgBox("new Customer?", vbYesNo + vbQuestion, "Select Customer") = vbYes Then

            Selection.InsertFile FileName:="01_new_customer_letter.doc", Range _

            :="", ConfirmConversions:=False, Link:=True, Attachment:=False

         Else

     

         Selection.InsertFile FileName:="02_existing_customer_ letter.doc", Range _

            :="", ConfirmConversions:=False, Link:=True, Attachment:=False

         End If

     ' end of select new or existing customer

    Selection.GoTo What:=wdGoToBookmark, Name:="Product_Outline"

        Selection.Find.ClearFormatting

        With Selection.Find

            .Text = ""

            .Replacement.Text = ""

            .Forward = True

            .Wrap = wdFindContinue

            .Format = False

            .MatchCase = False

            .MatchWholeWord = False

            .MatchWildcards = False

            .MatchSoundsLike = False

            .MatchAllWordForms = False

        End With

     

    cmbSatellite.AddItem "SD STB"

    cmbSatellite.AddItem "SD DVR ready"

    cmbSatellite.AddItem "SD DVR"

    cmbSatellite.AddItem "HD STB"

    cmbSatellite.AddItem "HD DVR ready"

    cmbSatellite.AddItem "HD DVR"

     

    cmbCable.AddItem "SD STB"

    cmbCable.AddItem "SD DVR ready"

    cmbCable.AddItem "SD DVR"

    cmbCable.AddItem "HD STB"

    cmbCable.AddItem "HD DVR ready"

    cmbCable.AddItem "HD DVR"

     

    cmbIPTV.AddItem "SD STB"

    cmbIPTV.AddItem "SD DVR ready"

    cmbIPTV.AddItem "SD DVR"

    cmbIPTV.AddItem "HD STB"

    cmbIPTV.AddItem "HD DVR ready"

    cmbIPTV.AddItem "HD DVR"

     

    cmbDDT.AddItem "SD STB"

    cmbDDT.AddItem "SD DVR ready"

    cmbDDT.AddItem "SD DVR"

    cmbDDT.AddItem "HD STB"

    cmbDDT.AddItem "HD DVR ready"

    cmbDDT.AddItem "HD DVR"

     

    cmbOTH.AddItem "Field Trial"

    cmbOTH.AddItem "Service 1"

    cmbOTH.AddItem "Service 2"

    cmbOTH.AddItem "Free text"

     

    End Sub

    Thursday, January 27, 2011 1:40 PM

All replies

  • I think that for what you want to do, the information in the following page of Greg Maxey's website :

    http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm

    might be applicable.


    Hope this helps.

    Doug Robbins - Word MVP,
    dkr[atsymbol]mvps[dot]org
    Posted via the Community Bridge

    "Acolwknt_at_pace" wrote in message news:f7e95a8f-cd05-4ea6-b20a-dc26ed9855e2@communitybridge.codeplex.com...

    Hi all I am trying to get 5 comboboxs (1st 2 = cmbSatellite & cmbCable) to work as a radio button group. I am using cmb"boxname".ListIndex = -1 to reset previous selections.
    The first box works fine if you select a cmbCable vale then a cmbSatellite value  the form returns the satellite selected values. However if you select a satellite selection then a cable selection  the form retuns no value.

    I tryed adding .setfocus but then nothing worked.

    Does anybody know how to do this?

    Code follows:

    'Variables:
    'Scope, Name, Type, description/comment
    Private booSAT As Boolean 'Satellite selected variable
    Private booCAB As Boolean 'Cable selected variable
    Private booIP  As Boolean 'IPTV selected variable
    Private booSdDe_STB As Boolean 'Standard Definition STB variable
    Private booSdDe_DVR As Boolean 'Standard Definition DVR variable
    Private booHiDe_STB As Boolean 'High Definition STB variable
    Private booHiDe_DVR As Boolean 'High Definition DVR variable

    Private Sub cmbSatellite_Click()
    cmbCable.ListIndex = -1
    'cmbSatellite.SetFocus
    If cmbSatellite.ListIndex = 0 Then
    booSAT = True
    booSdDe_STB = True
    ElseIf cmbSatellite.ListIndex = 1 Then
    booSAT = True
    booSdDe_DVR = True
    ElseIf cmbSatellite.ListIndex = 2 Then
    booSAT = True
    booSdDe_DVR = True
    ElseIf cmbSatellite.ListIndex = 3 Then
    booSAT = True
    booHiDe_STB = True
    ElseIf cmbSatellite.ListIndex = 4 Then
    booSAT = True
    booHiDe_STB = True
    ElseIf cmbSatellite.ListIndex = 5 Then
    booSAT = True
    booHiDe_DVR = True
    Else:  MsgBox "selected option " + cmbSatellite.ListIndex + "no box selected"
    End If
    End Sub

    Private Sub cmbCable_Click()
    cmbSatellite.ListIndex = -1
    'cmbCable.SetFocus
    If cmbCable.ListIndex = 0 Then
    booCAB = True
    booSdDe_STB = True
    ElseIf cmbCable.ListIndex = 1 Then
    booCAB = True
    booSdDe_DVR = True
    ElseIf cmbSatellite.ListIndex = 2 Then
    booCAB = True
    booSdDe_DVR = True
    ElseIf cmbSatellite.ListIndex = 3 Then
    booCAB = True
    booHiDe_STB = True
    ElseIf cmbSatellite.ListIndex = 4 Then
    booCAB = True
    booHiDe_STB = True
    ElseIf cmbSatellite.ListIndex = 5 Then
    booCAB = True
    booHiDe_DVR = True
    Else:  MsgBox "selected cable option " '+ cmbSatellite.ListIndex + "no box selected"
    End If
    End Sub



    Private Sub UserForm_Initialize()
    ' cmdOK.SetFocus
    Me.Hide

    cmbSatellite.AddItem "SD STB"
    cmbSatellite.AddItem "SD DVR ready"
    cmbSatellite.AddItem "SD DVR"
    cmbSatellite.AddItem "HD STB"
    cmbSatellite.AddItem "HD DVR ready"
    cmbSatellite.AddItem "HD DVR"

    cmbCable.AddItem "SD STB"
    cmbCable.AddItem "SD DVR ready"
    cmbCable.AddItem "SD DVR"
    cmbCable.AddItem "HD STB"
    cmbCable.AddItem "HD DVR ready"
    cmbCable.AddItem "HD DVR"

    End Sub


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Tuesday, January 25, 2011 10:25 PM
  • Hi Doug, Thanks I see from Gerg's  artical I can get the effect I wanted  by using cascading boxes however i am still intrested in knowiing if it is possible to group boxes so they act as a groupe of radio buttons. Also I am intrested in knowng why the cmbSatellite box works like I want  and the cmbCable box only works if I remove the "cmbSatellite.ListIndex = -1"  line, when both boxes contain similar code?
    Wednesday, January 26, 2011 9:52 AM
  • Hi Doug thanks for your help, I managed to solve the problem by using private integer variables inside the _Click() subroutines in case anybody is  interested in how it did it I the full form code follows.

      (from a template the maco builds a document by adding a new or existing customer covering letter to the selected description)

    'Final Code:

    ' Variables:

    ' Scope, Name, Type, description/comment

    Private SATidx As Integer 'Satellite and type of box selected variable (0-5)

    Private CABidx As Integer 'Cable and type of box selected variable (0-5)

    Private IPTVidx As Integer 'IPTV and type of box selected variable (0-5)

    Private DDTidx As Integer 'DDT and type of box selected variable (0-5)

    Private OTHidx As Integer 'Other and type of service selected variable (0-3)

     

    Private Sub cmbSatellite_Click()

    cmbCable.ListIndex = -1

    CABidx = -1

    cmbIPTV.ListIndex = -1

    IPTVidx = -1

    cmbDDT.ListIndex = -1

    DDTidx = -1

    cmbOTH.ListIndex = -1

    OTHidx = -1

    SATidx = cmbSatellite.ListIndex

    End Sub

     

    Private Sub cmbCable_Click()

    cmbSatellite.ListIndex = -1

    SATidx = -1

    cmbIPTV.ListIndex = -1

    IPTVidx = -1

    cmbDDT.ListIndex = -1

    DDTidx = -1

    cmbOTH.ListIndex = -1

    OTHidx = -1

    CABidx = cmbCable.ListIndex

    End Sub

     

    Private Sub cmbIPTV_Click()

    cmbSatellite.ListIndex = -1

    SATidx = -1

    cmbCable.ListIndex = -1

    CABidx = -1

    cmbDDT.ListIndex = -1

    DDTidx = -1

    cmbOTH.ListIndex = -1

    OTHidx = -1

    IPTVidx = cmbIPTV.ListIndex

    End Sub

     

    Private Sub cmbDDT_Click()

    cmbSatellite.ListIndex = -1

    SATidx = -1

    cmbCable.ListIndex = -1

    CABidx = -1

    cmbIPTV.ListIndex = -1

    IPTVidx = -1

    cmbOTH.ListIndex = -1

    OTHidx = -1

    DDTidx = cmbDDT.ListIndex

    End Sub

     

    Private Sub cmbOTH_Click()

    cmbSatellite.ListIndex = -1

    SATidx = -1

    cmbCable.ListIndex = -1

    CABidx = -1

    cmbIPTV.ListIndex = -1

    IPTVidx = -1

    cmbDDT.ListIndex = -1

    DDTidx = -1

    OTHidx = cmbOTH.ListIndex

    End Sub

     

    Private Sub cmdOK_Click()

    Me.Hide

    ' Select satellite, cable, DDT, IPTV or service

    If SATidx >= 0 Then

     GoTo SatBoxes

     End If

    If CABidx >= 0 Then

    GoTo CabBoxes

    End If

    If IPTVidx >= 0 Then

    GoTo IPTVBoxes

    End If

    If DDTidx >= 0 Then

    GoTo DDTBoxes

    End If

    If OTHidx >= 0 Then

    GoTo Other

    End If

     

    SatBoxes:

    ' Select type of box

    If SATidx = 0 Then

     Selection.InsertFile FileName:="03_SAT_SD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf SATidx = 1 Then

       Selection.InsertFile FileName:="04_SAT_SD_DVR_Ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf SATidx = 2 Then

       Selection.InsertFile FileName:="05_ SAT_SD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf SATidx = 3 Then

       Selection.InsertFile FileName:="06_ SAT_HD_STB.docc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf SATidx = 4 Then

       Selection.InsertFile FileName:="07_SAT_HD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf SATidx = 5 Then

       Selection.InsertFile FileName:="08_SAT_HD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    Else: MsgBox "No satellite box selected please select type: SD STB, SD DVR, HD STB or HD DVR"

    End If

    GoTo TandC

     

    CabBoxes:

    If CABidx = 0 Then

    Selection.InsertFile FileName:="09_ CAB_SD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf CABidx = 1 Then

    Selection.InsertFile FileName:="10_CAB_ SD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf CABidx = 2 Then

    Selection.InsertFile FileName:="11_CAB_SD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf CABidx = 3 Then

    Selection.InsertFile FileName:="12_CAB_HD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf CABidx = 4 Then

    Selection.InsertFile FileName:="13_CAB_HD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf CABidx = 5 Then

    Selection.InsertFile FileName:="14_CAB_HD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    Else: MsgBox "No cable box selected please select type: SD STB, SD DVR, HD STB or HD DVR"

    End If

     GoTo TandC

     

    IPTVBoxes:

    If IPTVidx = 0 Then

    Selection.InsertFile FileName:="15_IPTV_SD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf IPTVidx = 1 Then

    Selection.InsertFile FileName:="16_IPTV_SD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf IPTVidx = 2 Then

    Selection.InsertFile FileName:="17_IPTV_SD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf IPTVidx = 3 Then

    Selection.InsertFile FileName:="18_IPTV_HD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf IPTVidx = 4 Then

    Selection.InsertFile FileName:="19_IPTV_HD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf IPTVidx = 5 Then

    Selection.InsertFile FileName:="20_IPTV_HD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    Else: MsgBox "No IPTV box selected please select type: SD STB, SD DVR, HD STB or HD DVR"

    End If

    GoTo TandC

     

    DDTBoxes:

    If DDTidx = 0 Then

     Selection.InsertFile FileName:="21_DDT_SD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf DDTidx = 1 Then

       Selection.InsertFile FileName:="22_DDT_SD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf DDTidx = 2 Then

       Selection.InsertFile FileName:="23_ DDT_SD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf DDTidx = 3 Then

       Selection.InsertFile FileName:="24_DDT_HD_STB.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf DDTidx = 4 Then

       Selection.InsertFile FileName:="25_DDT_HD_DVR_ready.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf DDTidx = 5 Then

       Selection.InsertFile FileName:="26_DDT_HD_DVR.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    Else: MsgBox "No DDT box selected please select type: SD STB, SD DVR, HD STB or HD DVR"

    End If

    GoTo TandC

     

    Other:

    If OTHidx = 0 Then

     Selection.InsertFile FileName:="27_Other_Field_trial.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf OTHidx = 1 Then

       Selection.InsertFile FileName:="28_Other_service_1.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf OTHidx = 2 Then

       Selection.InsertFile FileName:="29_Other_service_2.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    ElseIf OTHidx = 3 Then

       Selection.InsertFile FileName:="30_Other_Free_text.doc", _

            Range:="", ConfirmConversions:=False, Link:=True, Attachment:=False

    Else: MsgBox "No service selected please select type"

    End If

    GoTo TandC

     

    TandC: 'Autonew macro calls next userform

    Unload Me

    End Sub

     

    Private Sub UserForm_Initialize()

    cmdOK.SetFocus

    Me.Hide

    Selection.GoTo What:=wdGoToBookmark, Name:="Covering_Letter"

        Selection.Find.ClearFormatting

        With Selection.Find

            .Text = ""

            .Replacement.Text = ""

            .Forward = True

            .Wrap = wdFindContinue

            .Format = False

            .MatchCase = False

            .MatchWholeWord = False

            .MatchWildcards = False

            .MatchSoundsLike = False

            .MatchAllWordForms = False

        End With

       

        If MsgBox("new Customer?", vbYesNo + vbQuestion, "Select Customer") = vbYes Then

            Selection.InsertFile FileName:="01_new_customer_letter.doc", Range _

            :="", ConfirmConversions:=False, Link:=True, Attachment:=False

         Else

     

         Selection.InsertFile FileName:="02_existing_customer_ letter.doc", Range _

            :="", ConfirmConversions:=False, Link:=True, Attachment:=False

         End If

     ' end of select new or existing customer

    Selection.GoTo What:=wdGoToBookmark, Name:="Product_Outline"

        Selection.Find.ClearFormatting

        With Selection.Find

            .Text = ""

            .Replacement.Text = ""

            .Forward = True

            .Wrap = wdFindContinue

            .Format = False

            .MatchCase = False

            .MatchWholeWord = False

            .MatchWildcards = False

            .MatchSoundsLike = False

            .MatchAllWordForms = False

        End With

     

    cmbSatellite.AddItem "SD STB"

    cmbSatellite.AddItem "SD DVR ready"

    cmbSatellite.AddItem "SD DVR"

    cmbSatellite.AddItem "HD STB"

    cmbSatellite.AddItem "HD DVR ready"

    cmbSatellite.AddItem "HD DVR"

     

    cmbCable.AddItem "SD STB"

    cmbCable.AddItem "SD DVR ready"

    cmbCable.AddItem "SD DVR"

    cmbCable.AddItem "HD STB"

    cmbCable.AddItem "HD DVR ready"

    cmbCable.AddItem "HD DVR"

     

    cmbIPTV.AddItem "SD STB"

    cmbIPTV.AddItem "SD DVR ready"

    cmbIPTV.AddItem "SD DVR"

    cmbIPTV.AddItem "HD STB"

    cmbIPTV.AddItem "HD DVR ready"

    cmbIPTV.AddItem "HD DVR"

     

    cmbDDT.AddItem "SD STB"

    cmbDDT.AddItem "SD DVR ready"

    cmbDDT.AddItem "SD DVR"

    cmbDDT.AddItem "HD STB"

    cmbDDT.AddItem "HD DVR ready"

    cmbDDT.AddItem "HD DVR"

     

    cmbOTH.AddItem "Field Trial"

    cmbOTH.AddItem "Service 1"

    cmbOTH.AddItem "Service 2"

    cmbOTH.AddItem "Free text"

     

    End Sub

    Thursday, January 27, 2011 1:40 PM