+ Reply to Thread
Results 1 to 2 of 2

Combobox to open word documents from excel

Hybrid View

  1. #1
    Registered User
    Join Date
    07-11-2012
    Location
    Utah
    MS-Off Ver
    Excel 2007
    Posts
    74

    Combobox to open word documents from excel

    I need a vba script for a combobox that would open word documents. There would be four options in the combo box and I would like each option to open two word documents. The options would be:
    "MSKR" and it would open mskrwr.doc and mskrfdl.doc. "WFABK" would open wfabkwr.doc and wfabkfdl.doc. "MLCA" would open mlcawr.doc and mlcafdl.doc "OPCO" would open opcowr.doc and you guessed it opcofdl.doc
    Does anybody have any thoughts.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Combobox to open word documents from excel

    gherzberg,

    Here's the generic code to open a Word doc:
    Shell "winword.exe ""C:\Folder\Subfolder\Filename.doc""", vbNormalFocus

    So to adjust, you can use variables:
    Dim strFolderPath As String
    
    'Change to the correct folder path, don't forget the ending \
    strFolderPath = "C:\Folder\Subfolder\"
    
    Shell "winword.exe """ & strFolderPath & ComboBox1.Text & "wr.doc""", vbNormalFocus
    Shell "winword.exe """ & strFolderPath & ComboBox1.Text & "fdl.doc""", vbNormalFocus
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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