+ Reply to Thread
Results 1 to 3 of 3

Outlook Form - list OPen Excel Workbooks in drop down combo box

  1. #1
    Registered User
    Join Date
    04-20-2016
    Location
    UK
    MS-Off Ver
    Office 365 version 13
    Posts
    2

    Outlook Form - list OPen Excel Workbooks in drop down combo box

    In excel, I have used the following code successfully as part of an Excel macro and form, to pre-popluate a form drop down combo box with the open excel workbooks, to allow the use to select which workbook.

    Private Sub UserForm_Initialize()
    Dim SOmething As Excel.Application


    Dim wkb As Workbook



    With Me.ComboBox1
    For Each wkb In Application.Workbooks
    .AddItem wkb.Name
    Next wkb
    End With

    LoadFrm
    End Sub

    Using the above code, does not seem to work in Outlook 2013. Returns an error object not set?


    I suspect its to do with the different methods, vba works within outlook rather than excel. Objective here, is to pre-populate an outlook form, with current open excel workbooks, allow the user to select the workbook to use, then use that selection, as variable without outlook, to export attributes of emails to the excel workbook selected.

    I have the rest of the code: just need the form selection of excel workbook to work.

    Any ideas?

    thanks

  2. #2
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: Outlook Form - list OPen Excel Workbooks in drop down combo box

    The code cannot work in Outlook... and your post is a little lacking in detail.

    The first question is have you set a reference to the Excel Object model using the Tools/References menu?

    Then what you have to do is declare an object either as a generic object or as 'Excel.Application' depending on the answer to the first question (declared as 'Something').

    You than need to get a reference to a running instance of Excel. If that succeeds you then loop through the workbooks but change the 'Application' to 'Something' in the'For' line. Application refers to the application running the code, which is Outlook and Outlook does not have a Workbooks collection. Not forgetting this will require some error handling code, and not just
    Please Login or Register  to view this content.
    General answer, reflects the level of detail in your post.

  3. #3
    Registered User
    Join Date
    04-20-2016
    Location
    UK
    MS-Off Ver
    Office 365 version 13
    Posts
    2

    Re: Outlook Form - list OPen Excel Workbooks in drop down combo box

    Thanks for the response and apologies for not responding sooner - I got distracted.

    Anyway, yes, in Outllook 2013, under VBA, References, I have the Microsoft Excel 15.0 Object Library selected. I believe Outlook does not recognize native Excel commands, but I am trying to find a way to make this happen.

    My basic objective here, to to have some Outlook code, called via a macro, to:
    Loop through a defined subfolder of Inbox
    identify particular emails within that subfolder, then
    populate key fields, detailed in the email header and contents, into a selected Excel workbook.

    for example:
    Email contained in Inbox > Certification
    email subject"Re: Response required - Certification"
    email contents, may include one or more statements, such as "I no longer require the account" or "The account is still in use" or "other comments"

    Objective, depending on the key words found in the contents, for each email in Certification folder I would like to output the responses, to an excel workbook, to include:
    Senders name
    email address
    date
    response

    I thought I would hard-code, all the excel workbook names, settings etc, but then thought (and hence my question) if I could have a form to allow a user of this code, to configure the options (excel workbook name, location, parameters to search for in each email and outputs, this would make the code more flexible for others to use.

    So I am looking for a way to control Excel via Outlook and to include within an outlook form, a list (via drop down) of all open excel workbooks, then using the workbook selected, use this in code, to output results to that workbook.

    I hope this makes more sense, if not please let me know.

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel Combo box search drop down list
    By Mathewj in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-17-2016, 01:56 PM
  2. Excel Combo box search drop down list
    By Mathewj in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2016, 05:18 AM
  3. [SOLVED] Create a form with a button to save the form and open Outlook
    By OmegaSea in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-03-2015, 05:12 PM
  4. how to use combo box in macbook pro excel for drop down suggestion list
    By sumit978 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-12-2014, 08:07 AM
  5. [SOLVED] Dependent drop down list in user form combo box vba
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-09-2014, 07:06 AM
  6. Open a document from a Combo Box drop down list with a Command Button.
    By Ortz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2012, 02:34 PM
  7. How do I create a combo drop down list in Excel?
    By Ron in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-15-2005, 04:06 PM

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