Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a ListBox to save my file

Status
Not open for further replies.

schnabs

Technical User
Jan 21, 2009
50
0
0
Hello,
I am combining and saving an excel file. Currently, this is how I am doing it.

newName = "Z:\2009 Combined Delinquencies\April\" + path

oxlBook1.SaveAs(newName)

What I would like to do, is create a listbox of the 12 months in the above directory, and have the user choose the month in which to save the file. Whether this be creating the folder if it does not exist, or I can create all the folders head of time.
Thanks in advance!
 

How about:
Code:
ListBox1.Items.Clear()

For i As Integer = 1 To 12
    ListBox1.Items.Add(MonthName(i))
Next
ListBox1.SelectedItem = MonthName(Month(Now))

newName = "Z:\2009 Combined Delinquencies\" & ListBox1.SelectedItem & "\" + path

oxlBook1.SaveAs(newName)

Have fun.

---- Andy
 
Looks good. I implemented the code, but when I build it, my box is there, with no names in it. Any ideas?
 

Where in your code (which event) do you have the code to populate the listbox?

When you step thru your code, does it go thru the code to populate the listbox?

Do you Clear the listbox anywhere?


Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top