View Single Post
  #2  
Old December 15th 06, 03:06 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Import Excel file to array to fill ComboBox

What about defining a range that covers all the cells you want to import?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Pentoast" wrote in message oups.com...
I've been having a bit of trouble getting this to work. I have arrived
at the point where the combo box gets filled with the information, but
I'm not familiar enough with VBScript to figure out the rest. Here is
what I have so far:

Sub Item_Open()

Set FormPage = Item.GetInspector.ModifiedFormPages("More Info")
Set Control = FormPage.Controls("cboCategories")

On Error Resume Next
Set objXL = GetObject(, "Excel.Application")
Err.Clear
If objXL Is Nothing Then
Set objXL = CreateObject("Excel.Application")
End If
On Error GoTo 0
Set Mybook = objXL.Workbooks.Add("C:\test\test.xls")
Mybook.Worksheets("Sheet1").Activate

MyVariable=objXL.Columns("a").Value

Set Mybook=Nothing
Set objXL=Nothing

Control.List() = MyVariable

End Sub


As you can tell, it loads all the information from Column A. The
problem is that it loads the ENTIRE column, not just the cells that are
filled. What can I do to filter out the empty cells?

Ads