View Single Post
  #1  
Old December 14th 06, 08:42 PM posted to microsoft.public.outlook.program_forms
Pentoast
external usenet poster
 
Posts: 5
Default Import Excel file to array to fill ComboBox

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