|
-
Feb 17th, 2006, 07:02 AM
#1
Thread Starter
Member
Default open location from combo box date
Hi,
This relates to Excel VBA
I have 12 folders which are named Jan, Feb, March... etc. I also have a combo box with the months of the years in. Is it possible to select one of the folders depending on what month the user selects in the combo box, so if the user selects Feb, the default location in a file open dialog box would be C:\project\feb?
Thanks
C19
-
Feb 17th, 2006, 09:19 AM
#2
Re: Default open location from combo box date
Sure
You can change the default file path every time the combobox is changed.
VB Code:
Const sBASE_PATH As String = "C:\project\"
Private Sub ComboBox1_Change()
Dim sMonth As String
sMonth = Me.ComboBox1.Value
Application.DefaultFilePath = sBASE_PATH & sMonth
End Sub
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Feb 17th, 2006, 10:27 AM
#3
Thread Starter
Member
Re: Default open location from combo box date
Hi,
Thanks for that - as a side do you know how to declare the sBASE_PATH to be viewable by all modules? i have a few procedures that refer to a database but would like to put the database path in one place.
Thanks
-
Feb 17th, 2006, 10:33 AM
#4
Re: Default open location from combo box date
 Originally Posted by c19h28O2
as a side do you know how to declare the sBASE_PATH to be viewable by all modules?
Add Public to the constant declaration
e.g.
VB Code:
Public Const sBASE_PATH As String = "C:\project\"
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|