+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    06-23-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    5

    Populating a word VBA combo box from excel

    Hi All,

    Basically i have a list in excel with customer addresses.
    I want to be able to keep this as the 'master database' and have a combo box in a template userform refer to it.
    That way the combo box will be updated if there is a change in the database.

    Can someone please let me know if this is possible.
    And some basic directions.

    Much appreciated.
    Lara

  2. #2
    Valued Forum Contributor snb's Avatar
    Join Date
    05-09-2010
    Location
    Europe
    MS-Off Ver
    Excel 2003
    Posts
    4,927

    Re: Populating a word VBA combo box from excel

    You have a userform in the Worddocument: Userform1
    The userform conains 1 combobox: Combobox1
    The name of the Excel file is: E:\Excel\adres.xls

    Put this code in the Userform module

    Code:
    Private Sub UserForm_Initialize()
      With GetObject("E:\Excel\adres.xls")
        Combobox1.List = .sheets(1).usedrange.Value
        .Close False
      End With
    End Sub
    Start the userform : Userform1.show

    That's about all.



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.2.0