Les Isaacs
Registered User.
- Local time
- Today, 23:13
- Joined
- May 6, 2008
- Messages
- 186
Hi All
I have inherited a complex Access2010 app
that includes a facility to create an also-complex Excel file
which has a lot of very specific attributes. The Excel file is based on an Excel 'template', which has a lot of VBA procedures to test data entered, and obviously the 'template' specifies the format of the cells (i.e. text, number, etc.).
Some of the cells have an associated dropdown, with value lists, and these are specified within the Access VBA that creates the Excel file - e.g.
With range("A" & lngRowCount).Validation
.Add type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Mr,Mrs,Miss,Ms,Dr"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = "Title"
.ErrorTitle = "Invalid Title"
.ErrorMessage = "You must enter a valid title (see dropdown list)"
End With
This all works fine
..... EXCEPT:
In the above example, if the user tries to enter "mr", this is rejected by the validation (because it's not "Mr")
. I know I could add "mr" to the dropdown list, but it would obviously be preferable to amend "mr" to "Mr" (using Propercase?) before the validation kicks in. Can this be done?
I have considered trying to do this as part of the Format within the Excel 'template' file, or within the VBA of the Excel 'template' file, or within the VBA in Access that creates the file (e.g. alongside the validation code above, etc.), but I can't seem to find a way of achieving what I need
.
Hope someone can help.
Thanks in advance
Les
I have inherited a complex Access2010 app


Some of the cells have an associated dropdown, with value lists, and these are specified within the Access VBA that creates the Excel file - e.g.
With range("A" & lngRowCount).Validation
.Add type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Mr,Mrs,Miss,Ms,Dr"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = "Title"
.ErrorTitle = "Invalid Title"
.ErrorMessage = "You must enter a valid title (see dropdown list)"
End With
This all works fine

In the above example, if the user tries to enter "mr", this is rejected by the validation (because it's not "Mr")

I have considered trying to do this as part of the Format within the Excel 'template' file, or within the VBA of the Excel 'template' file, or within the VBA in Access that creates the file (e.g. alongside the validation code above, etc.), but I can't seem to find a way of achieving what I need

Hope someone can help.
Thanks in advance
Les