+ Reply to Thread
Results 1 to 6 of 6

UserForm with ComboBoxes to open different Word docs

  1. #1
    Registered User
    Join Date
    03-02-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    11

    UserForm with ComboBoxes to open different Word docs

    Hi again,

    I am trying to develop a macro that will eliminate the need to sort through 400+ different Word docs of product labels.

    I've created a userform with 4 combo boxes (cboSize, cboSubstrate, cboColor, cboFootage) and have populated the lists for each.

    I'd like to have the macro open a particular word document based on the combo box selections.

    For example:

    If cboSize=05 and cboSubstrate=C and cboColor=A and cboFootage=100, then open xyz123.doc

    I know huge if/then strings are bad, but that's kind of how it's turning out.

    I've been stuck on this last step for a while now and really need a nudge in the right direction. I just need to program my Submit commandbutton to determine and open the appropriate Word doc, based on the information selected from the combo box options. I seriously appreciate any help I can get.

    Thanks in advance,
    Mike

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: UserForm with ComboBoxes to open different Word docs

    I'd be awfully tempted to have the possible combinations in a column, then in the next column the file that that combination would open, for example. Then just concatenate the comboboxes and look up the result.

  3. #3
    Registered User
    Join Date
    03-02-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: UserForm with ComboBoxes to open different Word docs

    I'm not sure I follow what you mean. I am open to virtually any idea, I'm just not a programmer and this project has taken me very far out of my element.

    I was thinking of a series of if/and/and/and/then statements, I just don't know the appropriate syntax to make the code work and be minimally messy.

  4. #4
    Registered User
    Join Date
    03-02-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: UserForm with ComboBoxes to open different Word docs

    Here is are some screencaps of what I'm working with. I have populated the combo box fields from the excel sheet. I basically just need one line of code that says:
    If Size=xx and Subs=yy and Color=zz and Feet=110 then open xxyyzz.doc
    If Size=aa and Subs=xy and Color=zz and Feet=110 then open aaxyzz.doc
    So on and so forth, approximately 430 times.
    SheetView1.JPGSheetView2.JPG

  5. #5
    Registered User
    Join Date
    03-02-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: UserForm with ComboBoxes to open different Word docs

    Also, the Size combo box has two columns (a size and a code). Does that affect the value selected in terms of syntax?

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: UserForm with ComboBoxes to open different Word docs

    Consider the following (bear in mind I have seen none of your code so I'm making some assumptions):

    1. All the combinations with the files they are supposed to open in sheet1.

    Column A Column B
    041/4KnitRIO50 D:\My Documents\Doc1.doc
    041/4KnitRIO100 D:\My Documents\Doc2.doc
    041/4KnitRIONonstandard D:\My Documents\Doc3.doc

    2. In the Form

    Please Login or Register  to view this content.
    Does this help?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1